All Projects → mcrio → Configuration.Provider.Docker.Secrets

mcrio / Configuration.Provider.Docker.Secrets

Licence: MIT license
.NET Core configuration provider for Docker Secrets.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Configuration.Provider.Docker.Secrets

Sio.core
✔ [ SIOC ] Swastika I/O Core is an all in one platform (e.g CMS, eCommerce, Forum, Q&A, CRM...) ASP.NET Core / Dotnet Core System based on SIOH Framework.
Stars: ✭ 121 (+505%)
Mutual labels:  dotnetcore, asp-net-core
Netcore Boilerplate
Boilerplate of API in .NET Core 3.1
Stars: ✭ 166 (+730%)
Mutual labels:  dotnetcore, asp-net-core
Nlayerappv3
Domain Driven Design (DDD) N-LayeredArchitecture with .Net Core 2
Stars: ✭ 138 (+590%)
Mutual labels:  dotnetcore, asp-net-core
Docker Series
Docker Series about containerizing ASP.NET Core app with MySQL..
Stars: ✭ 88 (+340%)
Mutual labels:  dotnetcore, asp-net-core
GPONMonitor
GPON Monitoring tool for Dasan Networks GPON OLTs
Stars: ✭ 26 (+30%)
Mutual labels:  dotnetcore, asp-net-core
Cronscheduler.aspnetcore
Cron Scheduler for AspNetCore 2.x/3.x or DotNetCore 2.x/3.x Self-hosted
Stars: ✭ 100 (+400%)
Mutual labels:  dotnetcore, asp-net-core
Storedprocedureefcore
Entity Framework Core extension to execute stored procedures
Stars: ✭ 164 (+720%)
Mutual labels:  dotnetcore, asp-net-core
Mix.core
🚀 Mixcore CMS is an open source CMS that support both headless and decoupled to easily build any kinds of app/web app/customisable APIs built on top of ASP.NET Core / Dotnet Core. It is a completely open source ASP.NET Core (Dotnet Core) CMS solution. https://mixcore.org
Stars: ✭ 304 (+1420%)
Mutual labels:  dotnetcore, asp-net-core
Uragano
Uragano, A simple, high performance RPC library. Support load balancing, circuit breaker, fallback, caching, intercepting.
Stars: ✭ 28 (+40%)
Mutual labels:  dotnetcore, asp-net-core
Anclafs
ASP.NET Core Library and Framework Support
Stars: ✭ 192 (+860%)
Mutual labels:  dotnetcore, asp-net-core
Restfulsense
A RESTFul operations client that serializes responses and throws meaningful exceptions for >= 400 status codes.
Stars: ✭ 28 (+40%)
Mutual labels:  dotnetcore, asp-net-core
eShopOnWeb
Sample ASP.NET Core 6.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
Stars: ✭ 8,250 (+41150%)
Mutual labels:  dotnetcore, asp-net-core
Awesome Microservices Netcore
💎 A collection of awesome training series, articles, videos, books, courses, sample projects, and tools for Microservices in .NET Core
Stars: ✭ 865 (+4225%)
Mutual labels:  dotnetcore, asp-net-core
Puck Core
Open source, cross platform .NET Core CMS. Fast, scalable, code-first, unobtrusive and extensible with powerful querying and Lucene integration.
Stars: ✭ 115 (+475%)
Mutual labels:  dotnetcore, asp-net-core
Ocelot
.NET core API Gateway
Stars: ✭ 6,675 (+33275%)
Mutual labels:  dotnetcore, asp-net-core
Active Directory B2c Dotnetcore Webapp
An ASP.NET Core web application that can sign in a user using Azure AD B2C, get an access token using MSAL.NET and call an API.
Stars: ✭ 160 (+700%)
Mutual labels:  dotnetcore, asp-net-core
Plato
Plato helps software teams connect & stay engaged with users to gather feedback, provide support & deliver better software.
Stars: ✭ 293 (+1365%)
Mutual labels:  dotnetcore, asp-net-core
Live.asp.net
Code for live.asp.net, which hosts the ASP.NET Community Stand-up
Stars: ✭ 295 (+1375%)
Mutual labels:  dotnetcore, asp-net-core
Angular 7 Project With Asp.net Core Apis
Angular 7 Project with ASP.NET CORE APIS | Angular Project
Stars: ✭ 174 (+770%)
Mutual labels:  dotnetcore, asp-net-core
DNZ.SEOChecker
SEO Checker and Recommander Plugin (like wordpress Yoast) for ASP.NET Core.
Stars: ✭ 18 (-10%)
Mutual labels:  dotnetcore, asp-net-core

.NET Core Configuration provider for Docker Secrets

Ability to map docker secrets files to .net core configuration.

Build status Nuget

This package allows reading docker secrets files and pull them into the .net core configuration. Docker by default mounts secrets as files at the /run/secrets directory. The secrets file names are used to identify the configuration targets.

About Docker Secrets

Docker secrets are part of the Docker swarm services. They are used to manage sensitive data which a container needs at runtime but which should not be stored in the container image or source control. Read more about docker secrets on the official docker documentation pages.

Getting Started

Using the NuGet package manager install the Mcrio.Configuration.Provider.Docker.Secrets package, or add the following line to the .csproj file:

<ItemGroup>
    <PackageReference Include="Mcrio.Configuration.Provider.Docker.Secrets">
        <Version>1.0.0</Version>
    </PackageReference>
</ItemGroup>

Note: Replace version value with the latest version available.

Usage

By default all files within the directory /run/secrets are scanned and processed as configuration. .NET Core configuration uses : as the section delimiter. As : cannot be used in file names, use __ in place where : is needed.

AddDockerSecrets() allows overriding of the default values for the secrets directory path and the colon placeholder.

Often we want to process just specific secrets files. By setting allowed prefixes we can narrow down which files will be processed.

Simple usage

var configuration = new ConfigurationBuilder()
                        .AddDockerSecrets()
                        .Build();
var secretValue = configuration["mysecret"];

ASP.NET Core

// Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration(configBuilder =>
                {
                    configBuilder.AddDockerSecrets();

                    // allow command line arguments to override docker secrets
                    if (args != null)
                    {
                        configBuilder.AddCommandLine(args);
                    }
                })
                .UseStartup<Startup>();

Only process files that start with a predefined prefix

configBuilder.AddDockerSecrets(
    allowedPrefixes: new List<string> 
    { 
        "ConfigSection1__", 
        "Foo__Bar__Baz" 
    }
);

Specify environment variable name that holds comma delimited list of allowed prefixes

setenv MY_SECRETS_PREFIXES "ConfigSection1__,Foo__Bar__Baz"
configBuilder.AddDockerSecrets("MY_SECRETS_PREFIXES");

Docker compose example

# docker compose compatible file
services:
    myservice:
      environment:
        - MY_SECRETS_PREFIXES=ConfigSection1__,Foo__Bar__Baz
    secrets:
      - source: myservice_foobarbaz_dbpass
        target: Foo__Bar__Baz__DbPassword

secrets:
    myservice_foobarbaz_dbpass:
        external: true
        name: myservice_foobarbaz_dbpass_2019_12_30_1
// Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration(configBuilder =>
                {
                    configBuilder.AddDockerSecrets(
                        allowedPrefixesEnvVariableName: "MY_SECRETS_PREFIXES"
                    );

                    // allow command line arguments to override docker secrets
                    if (args != null)
                    {
                        configBuilder.AddCommandLine(args);
                    }
                })
                .UseStartup<Startup>();

Release History

  • 1.0.1
    • Stable version that reads secret values from mounted files and pulls those into the configuration. Optionally filters the files to process by defined allowed prefixes.

Meta

Nikola Josipovic

This project is licensed under the MIT License. See License.md for more information.

Do you like this library?

₳ ADA | Buy me a coffee or two :)
addr1q87dhpq4wkm5gucymxkwcatu2et5enl9z8dal4c0fj98fxznraxyxtx5lf597gunnxn3tewwr6x2y588ttdkdlgaz79spp3avz

Ξ ETH | ...a nice cold beer :)
0xae0B28c1fCb707e1908706aAd65156b61aC6Ff0A

฿ BTC | ...or maybe a good read :)
bc1q3s8qjx59f4wu7tvz7qj9qx8w6ktcje5ktseq68

Happy if you stake ADA with Pale Blue Dot [PBD]
https://palebluedotpool.org
 

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].