Skip to content

Commit

Permalink
Merge pull request #31 from Aguafrommars/main
Browse files Browse the repository at this point in the history
fix preview
  • Loading branch information
aguacongas authored Feb 1, 2023
2 parents 1ac4053 + bc6395f commit dd7f8df
Show file tree
Hide file tree
Showing 27 changed files with 220 additions and 89 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Update all depencies each days if needed
name: Check Dependencies

# Controls when the action will run.
on:
# Triggers the workflow at 02:00 each days
schedule:
- cron: '0 2 * * *'
# allow to launch the job manually
workflow_dispatch:

jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checkout the branch fix/dependencies with the PAT
- uses: actions/checkout@v2
with:
ref: fix/dependencies
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Merge main
run: |
git config user.name github-actions
git config user.email [email protected]
git merge origin/main --allow-unrelated-histories
# Setup .NET Core SDK
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: 7.0.x
# Run update depencies script
- name: Update dependencies
run: ./update-dependencies.ps1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,4 @@ MigrationBackup/
.ionide/
/ReportGenerator
/coverage
.dccache
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Aguacongas.DynamicConfiguration.AdminApi/bin/Debug/net6.0/Aguacongas.DynamicConfiguration.AdminApi.dll",
"program": "${workspaceFolder}/src/Aguacongas.DynamicConfiguration.AdminApi/bin/Debug/net7.0/Aguacongas.DynamicConfiguration.AdminApi.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Aguacongas.DynamicConfiguration.AdminApi",
"stopAtEntry": false,
Expand Down
80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,81 @@
# DynamicConfiguration

Manage your .NET application configuration dynamically
Manage your .NET application configuration dynamically.

[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=Aguafrommars_DynamicConfiguration)](https://sonarcloud.io/dashboard?id=Aguafrommars_DynamicConfiguration)

[![Build status](https://ci.appveyor.com/api/projects/status/ufot0jcsr2bw6dg4/branch/main?svg=true)](https://ci.appveyor.com/project/aguacongas/dynamicconfiguration/branch/main)

Nuget packages
--------------
|Services|Redis Configuration Provider|Web API|Razor components|
|:------:|:------:|:------:|:------:|
|[![][Services-badge]][Services-nuget]|[![][Redis-badge]][Redis-nuget]|[![][WepAPI-badge]][WepAPI-nuget]|[![][Razor-badge]][Razor-nuget]|
|[![][Services-downloadbadge]][Services-nuget]|[![][Redis-downloadbadge]][Redis-nuget]|[![][WepAPI-downloadbadge]][WepAPI-nuget]|[![][Razor-downloadbadge]][Razor-nuget]|

[Services-badge]: https://img.shields.io/nuget/v/Aguacongas.DynamicConfiguration.svg
[Services-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.DynamicConfiguration.svg
[Services-nuget]: https://www.nuget.org/packages/Aguacongas.DynamicConfiguration/

[Redis-badge]: https://img.shields.io/nuget/v/Aguacongas.DynamicConfiguration.Redis.svg
[Redis-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.DynamicConfiguration.Redis.svg
[Redis-nuget]: https://www.nuget.org/packages/Aguacongas.DynamicConfiguration.Redis/

[WepAPI-badge]: https://img.shields.io/nuget/v/Aguacongas.DynamicConfiguration.WebApi.svg
[WepAPI-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.DynamicConfiguration.WebApi.svg
[WepAPI-nuget]: https://www.nuget.org/packages/Aguacongas.DynamicConfiguration.WebApi/

[Razor-badge]: https://img.shields.io/nuget/v/Aguacongas.DynamicConfiguration.Razor.svg
[Razor-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.DynamicConfiguration.Razor.svg
[Razor-nuget]: https://www.nuget.org/packages/Aguacongas.DynamicConfiguration.Razor/


## Description

This repository contains the source code of .NET library to dynamicaly configure your .NET applications.

``` bash
├─ sample
| ├─ RedisConfigurationSample
| ├─ YarpSample
├─ src
| ├─ Aguacongas.DynamicConfiguration
| ├─ Aguacongas.DynamicConfiguration.Redis
| ├─ Aguacongas.DynamicConfiguration.WebApi
| └─ Blazor
| └── Aguacongas.DynamicConfiguration.Razor
└─ test
```

### Services

[Aguacongas.DynamicConfiguration](src/Aguacongas.DynamicConfiguration/README.md) contains interfaces and services to dynamically configure .NET programs.

### Providers

[Aguacongas.DynamicConfiguration.Redis](src/Aguacongas.DynamicConfiguration.Redis/README.md) contains a [Configuration provider](https://docs.microsoft.com/en-us/dotnet/core/extensions/configuration-providers) implementation for [Redis](https://redis.io/).

### Web API
[Aguacongas.DynamicConfiguration.WebApi](src/Aguacongas.DynamicConfiguration.WebApi/README.md) contains a Web API to read and store the configuration.

![configuration-API-get.jpeg](doc/assets/configuration-API.jpeg)

### Components

[Aguacongas.DynamicConfiguration.Razor](src/Blazor/Aguacongas.DynamicConfiguration.Razor/Readme.md) contains Razor components to manage the configuration.

![configuration-API-get.jpeg](doc/assets/settings-component.jpeg)

## Setup

Each project contains a *Readme.md* containing information to use the library.

## Build from source

You can build the solution with Visual Studio or use the `dotnet build` command.

## Contribute

We warmly welcome contributions. You can contribute by opening an issue, suggest new a feature, or submit a pull request.

Read [How to contribute](CONTRIBUTING.md) and [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md) for more information.
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ image:
- Visual Studio 2019 Preview
environment:
GH_TOKEN:
secure: 0NJdORJRFjpB0dwUYv7bVNsbkldkoBhnvWik/CTOwAF/k9kP+/uTWMFnDcpEpt8E
donetsdk: 6.0.100
secure: /o9VAhx5ewGmdLR9qcgFJMzBaCuzOmGlsXAHu7khUJLdQzsv4gJzLUfYDghcRPHd
donetsdk: 7.0.100
JAVA_HOME: C:\Program Files\Java\jdk14
PATH: $(JAVA_HOME)\bin;$(PATH)
init:
Expand All @@ -38,7 +38,7 @@ artifacts:
deploy:
- provider: NuGet
api_key:
secure: bvkKhXIKsDM1ThfcWTbuusND0sOBiDoJGOoD2fYijGoj4C9xx22QKfR7Y9q+j7eX
secure: L5Ol2yiygLW8nUF6j5/rwx4feonMPly+S69GjoX1ilEUklPMixlX5RW2l8FJScNK
on:
branch:
- /preview\/*/
Expand Down
Binary file modified doc/assets/configuration-API-get.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/assets/configuration-API-set.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/assets/configuration-API.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/assets/settings-component.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions sample/RedisConfigurationSample/RedisConfigurationSample.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Aguacongas.DynamicConfiguration.Redis\Aguacongas.DynamicConfiguration.Redis.csproj" />
Expand Down
16 changes: 8 additions & 8 deletions sample/YarpSample/Yarp.AdminApi/Yarp.AdminApi.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>1760a456-20c7-402d-9941-3862601f7ab6</UserSecretsId>
Expand All @@ -10,17 +10,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions sample/YarpSample/YarpServer/YarpServer.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Yarp.ReverseProxy" Version="1.0.0" />
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="StackExchange.Redis" Version="2.6.90" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<OutputType>Library</OutputType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<OutputType>Library</OutputType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Aguacongas.DynamicConfiguration\Aguacongas.DynamicConfiguration.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Aguacongas.DynamicConfiguration/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Aguacongas.DynamicConfiguration

Interface and services to dynamically configure .NET programs.
Interfaces and services to dynamically configure .NET programs.

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ public Task<object> GetAsync(string typeName, string key = null)
/// <returns></returns>
public Task SetAsync(string key, string json)
{
_provider.Set(key, json);
_provider.Set(key, Sanitized(json));
return Task.CompletedTask;
}

private static string Sanitized(string value)
=> value.StartsWith("\"") ? value.Substring(1, value.Length - 2) : value;

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
Expand All @@ -14,11 +14,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="7.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit dd7f8df

Please sign in to comment.