File tree 1 file changed +20
-5
lines changed
1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -193,11 +193,26 @@ func MigrateConfigV1() error {
193
193
analyticsOptOut := GetConfig ("common.analytics_opt_out" )
194
194
analyticsDeviceID := GetConfig ("common.analytics_device_id" )
195
195
196
- // Clear the config
197
- viper .Set ("version" , 1 )
198
- viper .Set ("gas_station" , map [string ]interface {}{})
199
- viper .Set ("analytics" , map [string ]interface {}{})
200
- viper .Set ("common" , nil )
196
+ // Reset all viper settings
197
+ viper .Reset ()
198
+
199
+ // Reinitialize viper with the config file
200
+ homeDir , err := os .UserHomeDir ()
201
+ if err != nil {
202
+ return fmt .Errorf ("failed to get user home directory: %v" , err )
203
+ }
204
+ configPath := filepath .Join (homeDir , common .WeaveConfigFile )
205
+ viper .SetConfigFile (configPath )
206
+
207
+ // Create new clean config structure
208
+ newConfig := map [string ]interface {}{
209
+ "version" : 1 ,
210
+ "gas_station" : map [string ]interface {}{},
211
+ "analytics" : map [string ]interface {}{},
212
+ }
213
+
214
+ // Set the new base config
215
+ viper .Set ("" , newConfig )
201
216
202
217
// Restore the data
203
218
if gasStation != nil {
You can’t perform that action at this time.
0 commit comments