-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use old config files if available closes #3083 #3084
Conversation
log.Errorf("Could not rename file: %v", err) | ||
} | ||
} else if path, exists := configExists("lantern-2.0.0+stable.yaml"); exists { | ||
if err := os.Rename(path, cur); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch thanks! I changed that at the last minute -- fixing now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@@ -73,9 +75,59 @@ type CA struct { | |||
Cert string // PEM-encoded | |||
} | |||
|
|||
func exists(file string) bool { | |||
if _, err := os.Stat(file); os.IsNotExist(err) { | |||
fmt.Printf("no such file or directory: %s", file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing!
for _, file := range files { | ||
if path, exists := configExists(file); exists { | ||
if err := os.Rename(path, cur); err != nil { | ||
log.Errorf("Could not rename file: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah now with the loop that's a little easier. I did do that intentionally yeah just because we might be able to grab the next for some unknown reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change the log!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@@ -112,7 +160,7 @@ func Init(version string) (*Config, error) { | |||
return cfg.updateFrom(bytes) | |||
} | |||
} else { | |||
log.Errorf("Nil bytes?") | |||
log.Debugf("bytes is nil when the config is unmodified") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Use old config files if available closes #3083
No description provided.