Basic project structure
This commit is contained in:
26
config/config.go
Normal file
26
config/config.go
Normal file
@ -0,0 +1,26 @@
|
||||
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")))
|
||||
}
|
Reference in New Issue
Block a user