mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add support to read config from environment variable
Try to read app config from the "INVIDIOUS_CONFIG" environment variable. If the variable is undefined, read config from config.yml file as before. Required by https://github.com/omarroth/invidious/pull/1015 et al.
This commit is contained in:
parent
9841f74adc
commit
e3c10d779d
1 changed files with 5 additions and 2 deletions
|
@ -28,7 +28,10 @@ require "protodec/utils"
|
||||||
require "./invidious/helpers/*"
|
require "./invidious/helpers/*"
|
||||||
require "./invidious/*"
|
require "./invidious/*"
|
||||||
|
|
||||||
CONFIG = Config.from_yaml(File.read("config/config.yml"))
|
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)
|
HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
|
||||||
|
|
||||||
PG_URL = URI.new(
|
PG_URL = URI.new(
|
||||||
|
|
Loading…
Reference in a new issue