Skip to content

Commit

Permalink
Use HERMES_SERVER_DB_PASSWORD env var for postgresql password (#289)
Browse files Browse the repository at this point in the history
* Use HERMES_SERVER_DB_PASSWORD env var for postgresql password

* Update environment variable name

* Update environment variable name

---------

Co-authored-by: Josh Freda <[email protected]>
  • Loading branch information
GustavoAdrianGimenez and jfreda authored Aug 17, 2023
1 parent 3ff13d9 commit 1b63d36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Hermes can be configured to point to any PostgreSQL database, but for running lo
make docker/postgres/start
```

The database password can be configured via the Hermes config.hcl or the `HERMES_SERVER_POSTGRES_PASSWORD` environment variable.

### Run the Server

```sh
Expand Down
3 changes: 3 additions & 0 deletions internal/cmd/commands/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ func (c *Command) Run(args []string) int {
}

// Initialize database.
if val, ok := os.LookupEnv("HERMES_SERVER_POSTGRES_PASSWORD"); ok {
cfg.Postgres.Password = val
}
db, err := db.NewDB(*cfg.Postgres)
if err != nil {
c.UI.Error(fmt.Sprintf("error initializing database: %v", err))
Expand Down

0 comments on commit 1b63d36

Please sign in to comment.