Allow config defaults to be sourced from ENV

This allows the default config to source values from ENV variables if
they are set. With this change we don't have to modify the docker CMD or
edit the config.yml and then relaunch.
This commit is contained in:
Chris Alexander
2022-06-15 10:12:51 -05:00
parent 3b5e764d36
commit 2e91028ead
3 changed files with 50 additions and 27 deletions
+2 -2
View File
@@ -95,9 +95,9 @@ class String
end
end
def env_is_true?(key : String) : Bool
def env_is_true?(key : String, default : Bool = false) : Bool
val = ENV[key.upcase]? || ENV[key.downcase]?
return false unless val
return default unless val
val.downcase.in? "1", "true"
end