Remove hard coded pg password and pull the new rotated password from an environment variable

This commit is contained in:
David Dworken 2022-11-01 12:14:20 -07:00
parent 5554720451
commit 4f708aa58c
No known key found for this signature in database

View File

@ -24,9 +24,7 @@ import (
)
const (
// This password is for the postgres cluster running in my k8s cluster that is not publicly accessible. Some day I'll migrate it out of the code and rotate the password, but until then, this is fine.
// TODO: Migrate this
PostgresDb = "postgresql://postgres:O74Ji4735C@postgres:5432/hishtory?sslmode=disable"
PostgresDb = "postgresql://postgres:%s@postgres:5432/hishtory?sslmode=disable"
)
var (
@ -390,7 +388,7 @@ func OpenDB() (*gorm.DB, error) {
return db, nil
}
postgresDb := PostgresDb
postgresDb := fmt.Sprintf(PostgresDb, os.Getenv("POSTGRESQL_PASSWORD"))
if os.Getenv("HISHTORY_POSTGRES_DB") != "" {
postgresDb = os.Getenv("HISHTORY_POSTGRES_DB")
}