Skip to content

Commit

Permalink
update docker-compose.yml and log use of deprecated options
Browse files Browse the repository at this point in the history
  • Loading branch information
o-fl0w committed Oct 12, 2022
1 parent 01f7e3a commit 5e623c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ services:
#FILTERS: "frontpage" # show only scene filters from front page

#ALLOW_SYNC_MARKERS: "true"
#ENABLE_GLANCE_MARKERS: "true"
#ENABLE_HEATMAP_DISPLAY: "false"
#DISABLE_HEATMAP: "true"
#LOG_LEVEL: "debug"

#FORCE_HTTPS: "true"
12 changes: 12 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const (
envKeyAllowSyncMarkers = "ALLOW_SYNC_MARKERS"
)

var deprecatedEnvKeys = []string{"ENABLE_GLANCE_MARKERS", "HERESPHERE_QUICK_MARKERS", "HERESPHERE_SYNC_MARKERS", "ENABLE_HEATMAP_DISPLAY"}

type Application struct {
StashGraphQLUrl string
StashApiKey string
Expand All @@ -37,6 +39,7 @@ var once sync.Once

func Get() Application {
once.Do(func() {
logDeprecatedKeysInUse()
cfg = Application{
StashGraphQLUrl: getEnvOrDefault(envKeyStashGraphQLUrl, "http://localhost:9999/graphql"),
StashApiKey: getEnvOrDefault(envKeyStashApiKey, ""),
Expand All @@ -52,6 +55,15 @@ func Get() Application {
return cfg
}

func logDeprecatedKeysInUse() {
for _, key := range deprecatedEnvKeys {
val, found := os.LookupEnv(key)
if found {
log.Warn().Str("key", key).Str("value", val).Msg("Deprecated/removed option found. Ignoring.")
}
}
}

func getEnvOrDefault(key string, defaultValue string) string {
val, ok := os.LookupEnv(key)
if !ok {
Expand Down

0 comments on commit 5e623c1

Please sign in to comment.