summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2020-02-06 20:13:34 -0500
committerGitHub <noreply@github.com>2020-02-06 20:13:34 -0500
commitcb8e7181c48d7fd8c6e359660608d30cb1ebe1d6 (patch)
tree578ecd8049c7e6b5b7ea5a3812a90a74e7762aa1
parent9a3becdecca96cd6db9af2324ca7714fc35c6693 (diff)
parente3c10d779d315adc630e08005b6bdbdce32f7446 (diff)
downloadinvidious-cb8e7181c48d7fd8c6e359660608d30cb1ebe1d6.tar.gz
invidious-cb8e7181c48d7fd8c6e359660608d30cb1ebe1d6.tar.bz2
invidious-cb8e7181c48d7fd8c6e359660608d30cb1ebe1d6.zip
Merge pull request #1016 from leonklingele/config-env
Add support to read config from environment variable
-rw-r--r--src/invidious.cr7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index f5fe4b3d..a4584d4b 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -28,8 +28,11 @@ require "protodec/utils"
require "./invidious/helpers/*"
require "./invidious/*"
-CONFIG = Config.from_yaml(File.read("config/config.yml"))
-HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
+ENV_CONFIG_NAME = "INVIDIOUS_CONFIG"
+
+CONFIG_STR = ENV.has_key?(ENV_CONFIG_NAME) ? ENV.fetch(ENV_CONFIG_NAME) : File.read("config/config.yml")
+CONFIG = Config.from_yaml(CONFIG_STR)
+HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
PG_URL = URI.new(
scheme: "postgres",