Skip to content

AWS-Env Project for Loading SSM Variables into a .NET Environment

License

Notifications You must be signed in to change notification settings

RichardD012/DotNetAwsEnv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotNetAwsEnv

DotNetAwsEnv Build License: MIT NuGet version

A .NET library to load AWS parameter store variables into the environment. This is based on the aws-env project for loading data into the environment.

Installation

Available on NuGet

Visual Studio:

PM> Install-Package DotNetAwsEnv

.NET CLI:

dotnet add package DotNetAwsEnv

Usage

Load parameters file

Load() or LoadAsync() will automatically search for variables in parameter store and inject them into the environment.

DotNetAwsEnv.AwsEnv.Load("ssm/path/prefix");
await DotNetAwsEnv.AwsEnv.LoadAsync("ssm/path/prefix", cancellationToken);

Using .NET Configuration provider

Integrating with the usual ConfigurationBuilder can be used as well:

var configuration = new ConfigurationBuilder()
    .AddDotNetAwsEnv("ssm/path/prefix")
    .Build();

This will inject these variables into the Configuration Provider and can be used across the application with IConfiguration.

If you use this method over the aws-env library and expect variables to loaded in the same order, it must come before the var builder = WebApplication.CreateBuilder(args); call.

This is because the host builder will inject certain pieces of information, such as ASPNETCORE_ENVIRONMENT and those will not be picked up if the configuration is loaded after the host is created with CreateBuilder.

About

AWS-Env Project for Loading SSM Variables into a .NET Environment

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages