Open donvreug opened 7 years ago
Coma currently does not support such upgrade scenarios. So there is no ‘easy’ way I can think of to achieve this.
Also be careful, Default settings are not meant to get merged. The default setting files should get written once, and from there on be used as the ‘local’ settings that get merged to a single ‘local’ settings object.
Then only way I can think of is to do something like this.
void UpgradeSettingsToV2() { TomlTable currentConfig = Toml.ReadFile(“localuserconfig.toml”); TomlTable v2DefaultConfig = Toml.ReadString(DefaultUserConfig);
TomlTable v2CompatibleUserSettings = Merge(currentConfig, v2DefaultConfig);
Toml.Writefile(v2CompatibleUserSettings “localuserconfig.toml”);
// do the same for app settings…
}
The issue is, that you would need to implement the ‘Merge’ operation yourself. Implementing such a merge operation correctly is no easy task.
I’ll put new items for such upgrade scenarios into my backlog.
Best Regards, Philipp
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: donvreugmailto:notifications@github.com Sent: Sonntag, 14. Mai 2017 01:21 To: paiden/Nettmailto:Nett@noreply.github.com Cc: Subscribedmailto:subscribed@noreply.github.com Subject: [paiden/Nett] Write entire configuration to source files (#27)
I am using Nett.Coma.
Q: Is there a way to write the entire current configuration object to its local source files?
My scenario is thus:
I want to be able to introduce and remove settings following a software publishing update. To do this I will need to merge the local configuration with the new one, ensuring common settings are kept but new ones added and if a setting is no longer in the new config it gets removed form the local config. So I merge the configurations as such:
var config = Config.Create(() => new ConfigSettings(), defaultAppSettings, defaultUserSettings, localAppSettings, localUserSettings);
Where defaultAppSettings, defaultUserSettings, localAppSettings, and localUserSettings are strings.
Is this correct?
Now I would like to save the merged configuration back to the local files. Can I do this in one operation?
Or is there already a way to do this 'updating' in Nett.Coma?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/paiden/Nett/issues/27, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHT2ef0akyLyHyt5ciikxDvKBtq9FmRKks5r5jrXgaJpZM4NaOML.
I am using Nett.Coma.
Q: Is there a way to write the entire current configuration object to its local source files?
My scenario is thus:
I want to be able to introduce and remove settings following a software publishing update. To do this I will need to merge the local configuration with the new one, ensuring common settings are kept but new ones added and if a setting is no longer in the new config it gets removed form the local config. So I merge the configurations as such:
var config = Config.Create(() => new ConfigSettings(), defaultAppSettings, defaultUserSettings, localAppSettings, localUserSettings);
Where defaultAppSettings, defaultUserSettings, localAppSettings, and localUserSettings are strings.
Is this correct?
Now I would like to save the merged configuration back to the local files. Can I do this in one operation?
Or is there already a way to do this 'updating' in Nett.Coma?