Skip to content

Commit

Permalink
add env for production database
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtri6179 committed Mar 16, 2024
1 parent bf3573d commit 7a76a8f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions service/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DB_URL=postgresql://root:secret@localhost:5432/toeic?sslmode=disable
# DB on cloud: DB_URL=postgres://root:YCdFlv6VUDoTr1rLotzWzAs7k5kxzzMr@dpg-cl57p9182rpc73fqeld0-a.singapore-postgres.render.com/toeic
DB_on_cloud=secret

postgres:
docker run --name postgres12 -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:12-alpine

Expand All @@ -12,6 +13,9 @@ dropdb:
migrateup:
migrate -path db/migrations -database "${DB_URL}" -verbose up

migrateupcloud:
migrate -path db/migrations -database "${DB_on_cloud}" -verbose up

migratedown:
migrate -path db/migrations -database "${DB_URL}" -verbose down

Expand All @@ -21,4 +25,4 @@ sqlc:
createdata:
cd scripts && python3 create_db.py

.PHONY: postgres createdb dropdb migrateup migratedown sqlc createdata
.PHONY: postgres createdb dropdb migrateup migrateupcloud migratedown sqlc createdata

0 comments on commit 7a76a8f

Please sign in to comment.