From 06b80b97146af325b18b03afc5d8721182da4294 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Mon, 5 Jul 2021 20:37:47 -0400 Subject: [PATCH] use conn poll url first --- cmd/apollo-api/main.go | 7 ++++++- cmd/apollo-worker/main.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/apollo-api/main.go b/cmd/apollo-api/main.go index c4f8b05..b6bbcb0 100644 --- a/cmd/apollo-api/main.go +++ b/cmd/apollo-api/main.go @@ -35,7 +35,12 @@ func main() { var cfg config - db, err := sql.Open("postgres", os.Getenv("DATABASE_URL")) + dburl, ok := os.LookupEnv("DATABASE_CONNECTION_POOL_URL") + if !ok { + dburl = os.Getenv("DATABASE_URL") + } + + db, err := sql.Open("postgres", dburl) if err != nil { log.Fatal(err) } diff --git a/cmd/apollo-worker/main.go b/cmd/apollo-worker/main.go index 03088c3..4e7a041 100644 --- a/cmd/apollo-worker/main.go +++ b/cmd/apollo-worker/main.go @@ -124,7 +124,12 @@ func main() { rc := reddit.NewClient(os.Getenv("REDDIT_CLIENT_ID"), os.Getenv("REDDIT_CLIENT_SECRET")) - db, err := sql.Open("postgres", os.Getenv("DATABASE_URL")) + dburl, ok := os.LookupEnv("DATABASE_CONNECTION_POOL_URL") + if !ok { + dburl = os.Getenv("DATABASE_URL") + } + + db, err := sql.Open("postgres", dburl) if err != nil { log.Fatal(err) }