mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 16:26:25 +00:00
commit
75160d4d6a
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.5.3] - 2022-02-13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Error throwing not finding config even it's not being used.
|
||||||
|
|
||||||
## [1.5.2] - 2022-02-13
|
## [1.5.2] - 2022-02-13
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
14
cmd/root.go
14
cmd/root.go
@ -1,7 +1,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -80,20 +79,13 @@ func initConfig() {
|
|||||||
configPaths = append(configPaths, xdgConfig)
|
configPaths = append(configPaths, xdgConfig)
|
||||||
}
|
}
|
||||||
for _, cfgPath := range configPaths {
|
for _, cfgPath := range configPaths {
|
||||||
if internal.VERBOSE {
|
|
||||||
colors.Faint.Printf("> Adding config path: '%s'\n", cfgPath)
|
|
||||||
}
|
|
||||||
viper.AddConfigPath(cfgPath)
|
viper.AddConfigPath(cfgPath)
|
||||||
}
|
}
|
||||||
|
if internal.VERBOSE {
|
||||||
|
colors.Faint.Printf("Using config paths: %s\n", strings.Join(configPaths, " "))
|
||||||
|
}
|
||||||
cfgFileName := ".autorestic"
|
cfgFileName := ".autorestic"
|
||||||
viper.SetConfigName(cfgFileName)
|
viper.SetConfigName(cfgFileName)
|
||||||
viper.AutomaticEnv()
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "1.5.2"
|
const VERSION = "1.5.3"
|
||||||
|
|
||||||
var CI bool = false
|
var CI bool = false
|
||||||
var VERBOSE bool = false
|
var VERBOSE bool = false
|
||||||
@ -63,7 +63,12 @@ func GetConfig() *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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{}
|
var versionConfig interface{}
|
||||||
|
Loading…
Reference in New Issue
Block a user