Skip to content

joseftw/JOS.DockerSwarmSecretsConfigurationProvider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Usage

var host = new HostBuilder()
    .ConfigureHostConfiguration(configHost =>
    {
        ...
        configHost.AddDockerSwarmSecrets();
        ...
    });

The provider will look for secrets in the following default location /run/secrets. It will use the filename as the "configuration path" and the file contents as the value. All files in the /run/secrets folder will be added to the configuration dictionary.

Example: /run/secrets/mysecret will add "mysecret" to the configuration dictionary.

Configuration

It's possible to change the location of the secrets:

Secrets location

var host = new HostBuilder()
    .ConfigureHostConfiguration(configHost =>
    {
        ...
        configHost.AddDockerSwarmSecrets("/my/custom/path");
        ...
    })

Parsing of secrets

It's possible to pass in a custom Action<string> when adding the provider like this:

var host = new HostBuilder()
    .ConfigureHostConfiguration(configHost =>
    {
        ...
        configHost.AddDockerSwarmSecrets("/run/secrets", filePath =>
            {
                // Do something with the file
            });
        ...
    });

More information

https://josefottosson.se/dotnet-core-configurationprovider-for-docker-swarm-secrets/

About

Dotnet core ConfigurationProvider for Docker Swarm Secrets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages