Updating postgres variables
This commit is contained in:
parent
eba594a895
commit
c8f9e081f6
@ -1,6 +1,11 @@
|
|||||||
services:
|
services:
|
||||||
fedilogue:
|
fedilogue:
|
||||||
build: fedilogger/
|
build: fedilogue/
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: $POSTGRES_USER
|
||||||
|
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
||||||
|
POSTGRES_HOSTNAME: $POSTGRES_HOSTNAME
|
||||||
|
POSTGRES_DB: $POSTGRES_DB
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
ports:
|
ports:
|
||||||
@ -10,16 +15,17 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:6431:6432"
|
- "127.0.0.1:6431:6432"
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: $PGUSER
|
POSTGRES_USER: $POSTGRES_USER
|
||||||
POSTGRES_PASSWORD: $PGPASS
|
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
||||||
POSTGRES_DB: $PGDATABASE
|
POSTGRES_HOSTNAME: $POSTGRES_HOSTNAME
|
||||||
|
POSTGRES_DB: $POSTGRES_DB
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
db:
|
db:
|
||||||
image: postgres:alpine
|
image: postgres:alpine
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: $PGUSER
|
POSTGRES_USER: $POSTGRES_USER
|
||||||
POSTGRES_PASSWORD: $PGPASS
|
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
||||||
POSTGRES_DB: $PGDATABASE
|
POSTGRES_DB: $POSTGRES_DB
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres-data:/var/lib/postgresql
|
- ./postgres-data:/var/lib/postgresql
|
||||||
|
@ -11,7 +11,8 @@ var pool *pgxpool.Pool
|
|||||||
|
|
||||||
func getDbPool() *pgxpool.Pool {
|
func getDbPool() *pgxpool.Pool {
|
||||||
// Setup Database
|
// Setup Database
|
||||||
pool, err := pgxpool.Connect(context.Background(), os.Getenv("DATABASE_URL"))
|
dburl := "postgres://" + os.Getenv("POSTGRES_USER") + ":" +u os.Getenv("POSTGRES_PASSWORD") + "@" + os.Getenv("POSTGRES_HOSTNAME") + "/" + os.Getenv("POSTGRES_DB")
|
||||||
|
pool, err := pgxpool.Connect(context.Background(), dburl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Unable to connect to database:", err)
|
log.Fatal("Unable to connect to database:", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user