File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ func (t *Toolsium) Configure(cfgFile string) {
22
22
log .Debugf ("Using custom cfgFile %v" , cfgFile )
23
23
// Use config file from the flag.
24
24
t .Config .SetConfigFile (cfgFile )
25
- } else {
26
- // Search config in home directory with name ".toolsium" (without extension).
27
- t .ConfigureViper ()
25
+ t .SetConfigFileName (filepath .Base (cfgFile ))
26
+ t .SetConfigDir (filepath .Dir (cfgFile ))
28
27
}
28
+ t .configureViper ()
29
29
// If a config file is found, read it in.
30
30
if err := t .Config .ReadInConfig (); err == nil {
31
31
log .Infof ("Using config file: %v" , t .Config .ConfigFileUsed ())
@@ -84,8 +84,7 @@ func (t *Toolsium) GetConfigFilePath() string {
84
84
}
85
85
86
86
// Configures viper based on the provided passed directory and uses default file type and name.
87
- func ConfigureViper () { t .ConfigureViper () }
88
- func (t * Toolsium ) ConfigureViper () {
87
+ func (t * Toolsium ) configureViper () {
89
88
t .Config .AddConfigPath (t .GetConfigDir ())
90
89
t .Config .SetConfigType (cfgFileType )
91
90
t .Config .SetConfigName (t .GetConfigFileName ())
You can’t perform that action at this time.
0 commit comments