From 7742024dfb8eac6a94a4ab4b7d1879bc0a2257dc Mon Sep 17 00:00:00 2001 From: bnkai <48220860+bnkai@users.noreply.github.com> Date: Sat, 20 Apr 2019 19:54:27 +0300 Subject: [PATCH] Enviroment Variables (#45) * testing env version * added STASH_CACHE env * Remove debug prints used for testing * Update manager.go --- pkg/manager/manager.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 98771e7f5..5e9fb218e 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -36,6 +36,7 @@ func Initialize() *singleton { _ = utils.EnsureDir(paths.GetConfigDirectory()) initConfig() initFlags() + initEnvs() instance = &singleton{ Status: Idle, Paths: paths.NewPaths(), @@ -91,6 +92,16 @@ func initFlags() { } } +func initEnvs() { + viper.SetEnvPrefix("stash") // will be uppercased automatically + viper.BindEnv("host") // STASH_HOST + viper.BindEnv("port") // STASH_PORT + viper.BindEnv("stash") // STASH_STASH + viper.BindEnv("generated") // STASH_GENERATED + viper.BindEnv("metadata") // STASH_METADATA + viper.BindEnv("cache") // STASH_CACHE +} + func initFFMPEG() { configDirectory := paths.GetConfigDirectory() ffmpegPath, ffprobePath := ffmpeg.GetPaths(configDirectory)