Enviroment Variables (#45)

* testing env version

* added STASH_CACHE env

* Remove debug prints used for testing

* Update manager.go
This commit is contained in:
bnkai 2019-04-20 19:54:27 +03:00 committed by StashAppDev
parent bcc70af7e5
commit 7742024dfb
1 changed files with 11 additions and 0 deletions

View File

@ -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)