https://github.com/ignatandrei/appsettingseditor
app settings editor - powered by Roslyn
https://github.com/ignatandrei/appsettingseditor
appsettings appsettings-json appsettingsjson asp-net-core aspnet-core aspnetcore code-generation code-generator code-generators csharp csharp-sourcegenerator dotnet dotnet-core dotnetcore generator roslyn
Last synced: 6 months ago
JSON representation
app settings editor - powered by Roslyn
- Host: GitHub
- URL: https://github.com/ignatandrei/appsettingseditor
- Owner: ignatandrei
- License: mit
- Created: 2021-03-20T18:22:45.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-09T21:22:26.000Z (over 1 year ago)
- Last Synced: 2025-08-01T04:50:48.922Z (7 months ago)
- Topics: appsettings, appsettings-json, appsettingsjson, asp-net-core, aspnet-core, aspnetcore, code-generation, code-generator, code-generators, csharp, csharp-sourcegenerator, dotnet, dotnet-core, dotnetcore, generator, roslyn
- Language: JavaScript
- Homepage: https://ignatandrei.github.io/appSettingsEditor/
- Size: 541 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# appSettingsEditor
app settings editor - powered by Roslyn
## What it does
Autogenerates controller API for appsettings.json
Optional, it has also an endpoint for a HTML GUI editor
This is how swagger looks :

And you can browse to /settingsUI to have this editor ( powered by https://github.com/json-editor/json-editor )
## How to use
Add 2 NUGET references:
appSettingEditorAPI
appSettingsEditor
For your convenience, please add to the csproj :
```xml
PreserveNewest
true
$(BaseIntermediateOutputPath)Generated
```
If you want to see a GUI for settings ( /settingsUI) , please do
```csharp
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers(); // add next line
endpoints.MapSettingsView (Configuration);
});
```
If you want to handle security, add
```csharp
public partial class appsettingsController : ControllerBase
{
//partial void BeforeGet(appsettings data)
//{
//}
//partial void BeforeSave(appsettings data, appsettings original)
//{
//}
}
```
## Known problems and solving
### I have a versioning API .
Add this to Startup.cs ,
```csharp
public void ConfigureServices(IServiceCollection services)
services.AddApiVersioning(
it =>
{
it.AssumeDefaultVersionWhenUnspecified = true;
it.DefaultApiVersion = new ApiVersion(1,0);
}
);
```
### I have another file name app_custom_settings.json, not appsettings.json
Make the modifications below:
In the csproj
```xml
PreserveNewest
true
$(BaseIntermediateOutputPath)Generated
```
In the startup.cs
```csharp
appSettingsEditor.Extensions.MapSettingsView(endpoints, Configuration,"app_custom_setting.json","/api/app_custom_setting");
```
### I have multiple appsettings.json
This is not supported yet for the GUI. Please make an issue and describe your problem