Xabaril / Esquio

Esquio is a Feature Toggle Library for .NET Developers.
Apache License 2.0
428 stars 49 forks source link

Adding Azure App Configuration support to UI.Host #193

Closed cjaliaga closed 3 years ago

cjaliaga commented 3 years ago

Adding Azure App Configuration to the UI.Host project, making easier to use the Docker Image configured from Azure App Configuration.

Ported implementation from https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/tree/master/build/docker-images/HealthChecks.UI.Image

Implements #191

cjaliaga commented 3 years ago

@unaizorrilla I ported the implementation from HealthChecks.UI.Image as it's a great implementation when using Environment Variables (and that fits perfectly for the docker image scenario).

However, since the UI.Host can be cloned and extended, we could make it more flexible allowing to read the values from IConfiguration with the following structure out of the box:

public class AzureAppConfigurationOptions
{
    public bool Enabled { get; set; } = false;
    //If defined it will use User Assigned Identity instead of System Assigned
    public string ClientId { get; set; }
    public HashSet<string> Labels { get; set; } = new HashSet<string>();
    public string ConnectionString { get; set; }
    public Uri ManagedIdentityEndpoint {get; set; }
}
"AzureAppConfiguration": {
    "Enabled": true,
    "Labels": [
        "esquio",
        "global"
    ],
    "ManagedIdentityEndpoint": "https://myservice.azconfig.io"
}

What do you think?

unaizorrilla commented 3 years ago

Reviewing it!

unaizorrilla commented 3 years ago

Hi @cjaliaga

Looks good, and I agree with you, for me make more sense to get the values from IConfiguration instead of restricting it for Envvars !

If you do that, we will merge this PR

thanks for contribute this!

cjaliaga commented 3 years ago

@unaizorrilla I've updated the implementation getting the values from IConfiguration. Let me know what you think :)

I'm rebuilding the configuration after adding the new provider in order for Serilog to be configured from it. This allows to modify Serilog sinks from App Configuration if someone wants to do that.

unaizorrilla commented 3 years ago

I try to look at this today @cjaliaga !

Thanks

unaizorrilla commented 3 years ago

Looks good! Thanks for contribute and improve this! I try to release a new version of docker image right now!

Thanks again @cjaliaga

unaizorrilla commented 3 years ago

Hi again @cjaliaga

A new UI version is published on docker hub wiht 5.0.5 label

https://hub.docker.com/layers/xabarilcoding/esquioui/5.0.5/images/sha256-d83ea324ca38a058f74c015a9250bb96e29b6d153f0b0cfaaa05c5fa27c58286?context=explore

cjaliaga commented 3 years ago

Awesome :) Thanks a lot @unaizorrilla!!