A55.Aws.SecretsManager 1.0.6

dotnet add package A55.Aws.SecretsManager --version 1.0.6
NuGet\Install-Package A55.Aws.SecretsManager -Version 1.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="A55.Aws.SecretsManager" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add A55.Aws.SecretsManager --version 1.0.6
#r "nuget: A55.Aws.SecretsManager, 1.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install A55.Aws.SecretsManager as a Cake Addin
#addin nuget:?package=A55.Aws.SecretsManager&version=1.0.6

// Install A55.Aws.SecretsManager as a Cake Tool
#tool nuget:?package=A55.Aws.SecretsManager&version=1.0.6

A55 Aws Extensions for .NET [WIP]

A55.Aws.SecretsManager

Ains to read configuration keys from Aws SecretsManager into your app configuration

On your Program.cs just add

var builder = WebApplication.CreateBuilder(args);

builder.Configuration
    .AddEnvironmentVariables()
    .AddSecretManager();


Getting Start

Set those keys on root of your appsettings.json

{
    "ReadSettingsFromSecretManager": true,
    "SecretManagerProjectKey": "appName",
    "ACCESS_KEY_ID_SHARED": "",
    "SECRET_ACCESS_KEY_SHARED": "",
    "SESSION_TOKEN_SHARED": "",
    "REGION_SHARED": "us-east-1",
}

is recommended to have an appsettings file per environment, like appsettings.Staging.json and appsettings.Production.json, and set ReadSettingsFromSecretManager=true for non dev environments

** important ** : you dont need do set the aws credentials manually, if you add the .AddEnvironmentVariables() on the configuration before the .AddSecretManager() this extension will fill this credentials values from the environment variables with same name, which are:

ACCESS_KEY_ID_SHARED
SECRET_ACCESS_KEY_SHARED
SESSION_TOKEN_SHARED
REGION_SHARED

You also can set the appname on the configuration Extension:

builder.Configuration
    .AddEnvironmentVariables()
    .AddSecretManager("appName");

The appname is important to set which keys this extension will load in your configuration It will load the configuration on this fixed key paths and subpaths:

/settings/shared
/settings/{projectName}/shared/
/settings/{projectName}/{envAlias}/

the envAlias is mapped from your ASPNETCORE_ENVIRONMENT:

Development => dev
Staging => stg
Production => prd

Postgres ConnectionString

To load the database credentials you need to have a key on SecretsManager as /settings/{projectName}/{envAlias}/db, this extension will map the database credentials to a valid connection string on ConnectionStrings:DefaultConnection The expected secret value fields to map the ConnectionString are:

{
	"name": "db_app_env",
	"user": "app_db_user",
	"host": "db-datasources-env.a55.local",
	"port": "5432",
	"password": "#senhaSecreta@123"
}

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 2,041 2/25/2023
1.0.5 397 2/7/2023
1.0.4 534 12/23/2022