remove support for legacy client config file
Signed-off-by: Steve Kriss <krisss@vmware.com>pull/1323/head
parent
b87de94723
commit
ede9a8f5b4
|
@ -33,42 +33,6 @@ const (
|
|||
func LoadConfig() (map[string]string, error) {
|
||||
fileName := configFileName()
|
||||
|
||||
_, err := os.Stat(fileName)
|
||||
if os.IsNotExist(err) {
|
||||
// if the file isn't there, try loading from the legacy
|
||||
// location
|
||||
// TODO(1.0): remove this line and uncomment the code
|
||||
// just below.
|
||||
return LoadLegacyConfig()
|
||||
|
||||
// If the file isn't there, just return an empty map
|
||||
// return map[string]string{}, nil
|
||||
}
|
||||
if err != nil {
|
||||
// For any other Stat() error, return it
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
configFile, err := os.Open(fileName)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
defer configFile.Close()
|
||||
|
||||
var config map[string]string
|
||||
if err := json.NewDecoder(configFile).Decode(&config); err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// LoadLegacyConfig loads the Ark client configuration file and returns it as a map[string]string. If the
|
||||
// file does not exist, an empty map is returned.
|
||||
// TODO(1.0): remove this function
|
||||
func LoadLegacyConfig() (map[string]string, error) {
|
||||
fileName := legacyConfigFileName()
|
||||
|
||||
_, err := os.Stat(fileName)
|
||||
if os.IsNotExist(err) {
|
||||
// If the file isn't there, just return an empty map
|
||||
|
@ -115,8 +79,3 @@ func SaveConfig(config map[string]string) error {
|
|||
func configFileName() string {
|
||||
return filepath.Join(os.Getenv("HOME"), ".config", "velero", "config.json")
|
||||
}
|
||||
|
||||
// TODO(1.0): remove this function
|
||||
func legacyConfigFileName() string {
|
||||
return filepath.Join(os.Getenv("HOME"), ".config", "ark", "config.json")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue