mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-11-05 05:04:13 +01:00
only check on config if it is getting used
This commit is contained in:
parent
a373c07fb0
commit
2a7e233cdb
@ -1,10 +1,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/cupcakearmy/autorestic/internal"
|
||||
"github.com/cupcakearmy/autorestic/internal/colors"
|
||||
@ -88,12 +86,5 @@ func initConfig() {
|
||||
cfgFileName := ".autorestic"
|
||||
viper.SetConfigName(cfgFileName)
|
||||
viper.AutomaticEnv()
|
||||
if viper.ConfigFileUsed() == "" {
|
||||
colors.Error.Println(
|
||||
fmt.Sprintf(
|
||||
"cannot find configuration file '%s.yml' or '%s.yaml' in config paths: ['%s']",
|
||||
cfgFileName, cfgFileName, strings.Join(configPaths, "', '")))
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,12 @@ func GetConfig() *Config {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return
|
||||
cfgFileName := ".autorestic"
|
||||
colors.Error.Println(
|
||||
fmt.Sprintf(
|
||||
"cannot find configuration file '%s.yml' or '%s.yaml'.",
|
||||
cfgFileName, cfgFileName))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var versionConfig interface{}
|
||||
|
Loading…
Reference in New Issue
Block a user