mirror of
				https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
				synced 2024-08-15 00:53:38 +00:00 
			
		
		
		
	Merge pull request #1016 from leonklingele/config-env
Add support to read config from environment variable
This commit is contained in:
		
						commit
						cb8e7181c4
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -28,8 +28,11 @@ 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"
 | 
				
			||||||
HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32)
 | 
					
 | 
				
			||||||
 | 
					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(
 | 
					PG_URL = URI.new(
 | 
				
			||||||
  scheme: "postgres",
 | 
					  scheme: "postgres",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue