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
<PackageReference Include="A55.Aws.SecretsManager" Version="1.0.6" />
paket add A55.Aws.SecretsManager --version 1.0.6
#r "nuget: A55.Aws.SecretsManager, 1.0.6"
// 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 | Versions 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. |
-
net6.0
- AWSSDK.SecretsManager.Caching (>= 1.0.5)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 6.0.1)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- Npgsql (>= 6.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.