Resolve issue with debian package building, use $HOME/.config/pastee as config path

This commit is contained in:
Tyler
2021-03-27 18:15:26 -04:00
parent 9c0c218f46
commit 5901ca6d6c
2 changed files with 6 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
"path"
)
var rootCmd = &cobra.Command{
@ -48,9 +49,10 @@ func initConfig() {
home, err := homedir.Dir()
cobra.CheckErr(err)
viper.SetConfigName(".pastee")
viper.SetConfigName("pastee")
viper.SetConfigType("yaml")
viper.AddConfigPath(home)
viper.AddConfigPath(path.Join(home, ".config", "pastee"))
viper.AddConfigPath("/etc")
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {