Skip to content

Commit 51f6cc3

Browse files
committed
clean up
1 parent 07ae10f commit 51f6cc3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

main.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,25 @@ func main() {
134134

135135
cli.CompletionOptions.HiddenDefaultCmd = true
136136

137-
// create a default profile if file does not exist
138-
if _, err := config.ReadConfigFromFile(); os.IsNotExist(err) {
137+
// create a default profile if file does not exist
138+
if previousConfig, err := config.ReadConfigFromFile(); os.IsNotExist(err) {
139139
conf := config.Config{
140140
Profiles: map[string]config.Profile{"demo": defaultInitialProfile()},
141141
DefaultProfile: "demo",
142142
}
143143
config.WriteConfigToFile(&conf)
144+
} else {
145+
// updates the demo profile for existing users
146+
_, exists := previousConfig.Profiles["demo"]
147+
if exists {
148+
conf := config.Profile{
149+
URL: "http://demo.parseable.com",
150+
Username: "admin",
151+
Password: "admin",
152+
}
153+
previousConfig.Profiles["demo"] = conf
154+
config.WriteConfigToFile(previousConfig)
155+
}
144156
}
145157

146158
err := cli.Execute()

0 commit comments

Comments
 (0)