Writeable AppSettings to disk

After reading the docs I’ve noticed there’s no disk writable appsettings implementation? Was there a reason for this? I know MS Configuration framework doesn’t seem to support it either, so I guess I’ll have to roll my own.

I’m working on a CLI-based Continuous Integration tool, and when the CLI starts from a given folder, it must persist some basic settings to a config file created in that folder, and then some CLI args will update those settings.

I notice when using MS IConfigurationBuilder.AddJsonFile it has the option to reload on change so perhaps I can create a config DTO and serialize to JSON and write it to a file which should get picked up by IConfiguration.

Just wondering why some basic text writer wasn’t considered.

AppSettings are typically read-only configuration which can be combined from various sources which you can’t enforce being writable. You’d need to deal with permissions, file locking & synchronization for writing to local files. If you want your App restarted definitely use the official ASP.NET Core APIs since they manage the App restart.

But OrmLiteAppSettings does support writing configuration to the supported RDBMS it’s configured with, likewise SimpleAppSettings and DictionarySettings is writable in memory (doesn’t persist anywhere) and whilst EnvironmentVariableSettings doesn’t support writing Environment variables directly, you can write them in your App which will be used next time it’s accessed.