diff options
| author | syeopite <syeopite@syeopite.dev> | 2025-01-21 17:20:54 -0800 |
|---|---|---|
| committer | syeopite <syeopite@syeopite.dev> | 2025-01-22 10:34:04 -0800 |
| commit | 5d9ed95ffded4b304f360257af376f3eea03c117 (patch) | |
| tree | 8cd285b0071a52b1c6df069d92d3470bc63a549e /src | |
| parent | bfa6da2474cfb3767b1b0913b53aa27f74e3f9a0 (diff) | |
| download | invidious-5d9ed95ffded4b304f360257af376f3eea03c117.tar.gz invidious-5d9ed95ffded4b304f360257af376f3eea03c117.tar.bz2 invidious-5d9ed95ffded4b304f360257af376f3eea03c117.zip | |
Warn when any top-level config is "CHANGE_ME!!"
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/config.cr | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/invidious/config.cr b/src/invidious/config.cr index c4ca622f..4b3bdafc 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -184,6 +184,9 @@ class Config config = Config.from_yaml(config_yaml) # Update config from env vars (upcased and prefixed with "INVIDIOUS_") + # + # Also checks if any top-level config options are set to "CHANGE_ME!!" + # TODO: Support non-top-level config options such as the ones in DBConfig {% for ivar in Config.instance_vars %} {% env_id = "INVIDIOUS_#{ivar.id.upcase}" %} @@ -220,6 +223,12 @@ class Config exit(1) end end + + # Warn when any config attribute is set to "CHANGE_ME!!" + if config.{{ivar.id}} == "CHANGE_ME!!" + puts "Config: The value of '#{ {{ivar.stringify}} }' needs to be changed!!" + exit(1) + end {% end %} # HMAC_key is mandatory @@ -227,9 +236,6 @@ class Config if config.hmac_key.empty? puts "Config: 'hmac_key' is required/can't be empty" exit(1) - elsif config.hmac_key == "CHANGE_ME!!" - puts "Config: The value of 'hmac_key' needs to be changed!!" - exit(1) end # Build database_url from db.* if it's not set directly |
