adept/config/config.go

27 lines
512 B
Go
Raw Permalink Normal View History

2022-08-31 19:56:06 -04:00
package config
import (
"log"
"os"
"github.com/spf13/viper"
"git.metaunix.net/BitGoblin/adept/util"
)
func LoadConfig() {
viper.SetConfigName("adept")
viper.SetConfigType("toml")
viper.AddConfigPath("/etc/adept/")
viper.AddConfigPath(util.ResolveTilde("~/.config/"))
err := viper.ReadInConfig()
if err != nil {
log.Fatalf("Fatal error occurred while reading config: %s\n", err)
os.Exit(1)
}
viper.Set("transcoder.repository", util.ResolveTilde(viper.GetString("transcoder.repository")))
}