Skip to content

Commit

Permalink
move imports to systems.go
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-dzeda committed Jan 8, 2024
1 parent d47bc3d commit 36aade2
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion docker-compose.migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ services:
image: migrate/migrate
volumes:
- .:/go/src/github.com/CMSgov/bcda-ssas-app
- ./ssas/cfg/configs:/usr/local/configs
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ services:
- BCDA_AUTH_PROVIDER=${BCDA_AUTH_PROVIDER}
- BCDA_SSAS_CLIENT_ID=${BCDA_SSAS_CLIENT_ID}
- BCDA_SSAS_SECRET=${BCDA_SSAS_SECRET}
- DEBUG=true
- DEPLOYMENT_TARGET=local
- SSAS_ADMIN_SIGNING_KEY_PATH=../shared_files/ssas/admin_test_signing_key.pem
- SSAS_PUBLIC_SIGNING_KEY_PATH=../shared_files/ssas/public_test_signing_key.pem
Expand Down
1 change: 1 addition & 0 deletions ssas/cfg/configs/dev.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEBUG=TRUE
DEPLOYMENT_TARGET=dev
SSAS_DEFAULT_SYSTEM_SCOPE=bcda-api
SSAS_IDLE_TIMEOUT=120
Expand Down
1 change: 1 addition & 0 deletions ssas/cfg/configs/local.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEBUG=TRUE
DEPLOYMENT_TARGET=local
SSAS_DEFAULT_SYSTEM_SCOPE=bcda-api
SSAS_IDLE_TIMEOUT=120
Expand Down
1 change: 1 addition & 0 deletions ssas/cfg/configs/opensbx.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEBUG=FALSE
DEPLOYMENT_TARGET=opensbx
SSAS_DEFAULT_SYSTEM_SCOPE=bcda-api
SSAS_IDLE_TIMEOUT=120
Expand Down
1 change: 1 addition & 0 deletions ssas/cfg/configs/prod.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEBUG=FALSE
DEPLOYMENT_TARGET=prod
SSAS_DEFAULT_SYSTEM_SCOPE=bcda-api
SSAS_IDLE_TIMEOUT=120
Expand Down
1 change: 1 addition & 0 deletions ssas/cfg/configs/test.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEBUG=FALSE
DEPLOYMENT_TARGET=test
SSAS_DEFAULT_SYSTEM_SCOPE=bcda-api
SSAS_IDLE_TIMEOUT=120
Expand Down
9 changes: 0 additions & 9 deletions ssas/service/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
"github.com/CMSgov/bcda-ssas-app/ssas/service/public"
"github.com/go-chi/chi/v5"
gcmw "github.com/go-chi/chi/v5/middleware"
"github.com/joho/godotenv"
"github.com/newrelic/go-agent/v3/newrelic"
"gorm.io/gorm"
)
Expand Down Expand Up @@ -81,14 +80,6 @@ func init() {
if nil != err {
ssas.Logger.Warnf("New Relic integration is disabled: %s", err)
}
env := os.Getenv("DEPLOYMENT_TARGET")
envPath := fmt.Sprintf("/usr/local/configs/%s.env", env)
err = godotenv.Load(envPath)

if err != nil {
ssas.Logger.Error("Unable to load environment file, exiting.")
os.Exit(-1)
}

}

Expand Down
9 changes: 9 additions & 0 deletions ssas/systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"

"github.com/CMSgov/bcda-ssas-app/ssas/cfg"
"github.com/joho/godotenv"
"github.com/pborman/uuid"
"gorm.io/gorm"
)
Expand All @@ -31,6 +32,14 @@ func init() {
}

func getEnvVars() {
env := os.Getenv("DEPLOYMENT_TARGET")
envPath := fmt.Sprintf("/usr/local/configs/%s.env", env)
err := godotenv.Load(envPath)

if err != nil {
//ssas.Logger.Error("Unable to load environment file, exiting.")
os.Exit(-1)
}
DefaultScope = os.Getenv("SSAS_DEFAULT_SYSTEM_SCOPE")

if DefaultScope == "" {
Expand Down

0 comments on commit 36aade2

Please sign in to comment.