diff --git a/README.md b/README.md index fa9e332..937c521 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Environment: ``` "GAIA_URL" = "http://gaia-node1:26657" # gaia URL "DB_HOST" = "postgres-chain:5432" # Postgres host:port +"DB_NAME" = "postgres" # DB name "DB_USER" = "postgres" # DB username "DB_PW"= "mypwd" # DB password "LCD_URL" = "https://gaia-lcd:1317" # gaia lcd URL @@ -26,6 +27,7 @@ Environment: ``` "GAIA_URLs" = "http://gaia-node0:26657,http://gaia-node1:26657" # gaia URLs (comma-separated) "DB_HOST" = "postgres-chain:5432" # Postgres host:port +"DB_NAME" = "postgres" # DB name "DB_USER" = "postgres" # DB username "DB_PW"= "mypwd" # DB password "PERIOD" = "10" # Period to save data in seconds @@ -39,6 +41,7 @@ Environment: ``` "DB_HOST" = "postgres-chain:5432" # Postgres host:port "DB_USER" = "postgres" # DB username +"DB_NAME" = "postgres" # DB name "DB_PW"= "mypwd" # DB password "RAVEN_DSN" = "http://xxxxxxx" # DSN_URL from Sentry (hosted or self-hosted) "ADDRESS" = "ABCDDED" # Address of the validator to alert on diff --git a/alerter/main.go b/alerter/main.go index 35143fe..b0abfe1 100644 --- a/alerter/main.go +++ b/alerter/main.go @@ -23,6 +23,9 @@ func main() { if os.Getenv("DB_HOST") == "" { panic(errors.New("DB_HOST needs to be set")) } + if os.Getenv("DB_NAME") == "" { + panic(errors.New("DB_NAME needs to be set")) + } if os.Getenv("DB_USER") == "" { panic(errors.New("DB_USER needs to be set")) } @@ -42,6 +45,7 @@ func main() { // Connect to the postgres datastore db := pg.Connect(&pg.Options{ Addr: os.Getenv("DB_HOST"), + Database: os.Getenv("DB_NAME"), User: os.Getenv("DB_USER"), Password: os.Getenv("DB_PW"), }) diff --git a/main.go b/main.go index c5d203d..0eda65a 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,9 @@ func main() { if os.Getenv("DB_HOST") == "" { panic(errors.New("DB_HOST needs to be set")) } + if os.Getenv("DB_NAME") == "" { + panic(errors.New("DB_NAME needs to be set")) + } if os.Getenv("DB_USER") == "" { panic(errors.New("DB_USER needs to be set")) } @@ -43,6 +46,7 @@ func main() { db := pg.Connect(&pg.Options{ Addr: os.Getenv("DB_HOST"), + Database: os.Getenv("DB_NAME"), User: os.Getenv("DB_USER"), Password: os.Getenv("DB_PW"), }) diff --git a/net_exporter/main.go b/net_exporter/main.go index e02cc98..bc59524 100644 --- a/net_exporter/main.go +++ b/net_exporter/main.go @@ -29,6 +29,9 @@ func main() { if os.Getenv("DB_HOST") == "" { panic(errors.New("DB_HOST needs to be set")) } + if os.Getenv("DB_NAME") == "" { + panic(errors.New("DB_NAME needs to be set")) + } if os.Getenv("DB_USER") == "" { panic(errors.New("DB_USER needs to be set")) } @@ -57,6 +60,7 @@ func main() { // Connect to the postgres datastore db := pg.Connect(&pg.Options{ Addr: os.Getenv("DB_HOST"), + Database: os.Getenv("DB_NAME"), User: os.Getenv("DB_USER"), Password: os.Getenv("DB_PW"), })