BarakoCMS.Secrets.Gcp 5.0.0

dotnet add package BarakoCMS.Secrets.Gcp --version 5.0.0
                    
NuGet\Install-Package BarakoCMS.Secrets.Gcp -Version 5.0.0
                    
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="BarakoCMS.Secrets.Gcp" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BarakoCMS.Secrets.Gcp" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="BarakoCMS.Secrets.Gcp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BarakoCMS.Secrets.Gcp --version 5.0.0
                    
#r "nuget: BarakoCMS.Secrets.Gcp, 5.0.0"
                    
#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.
#:package BarakoCMS.Secrets.Gcp@5.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BarakoCMS.Secrets.Gcp&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=BarakoCMS.Secrets.Gcp&version=5.0.0
                    
Install as a Cake Tool

BarakoCMS.Secrets.Gcp

Loads barakoCMS configuration values from Google Secret Manager at startup, so the keys that protect stored secrets (JWT:Key, Secrets:Key, Connectors:Key, Mfa:Key) and module credentials do not have to sit in environment variables on the same machine as the database.

It is a configuration source, not a module: there is nothing to enable. It authenticates with Google's application default credentials, which on Google Cloud is the service account the instance runs as, and reads no key from barakoCMS configuration. With nothing mapped it adds nothing and makes no call, so installing it changes nothing until you configure it.

Install

dotnet add package BarakoCMS.Secrets.Gcp

The published image (ghcr.io/baryodev/barako-cms) already includes it. A host of your own adds the source to its configuration before AddBarakoCMS:

using BarakoCMS.Secrets.Gcp;

var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddBarakoGcpSecrets();
builder.Services.AddBarakoCMS(builder.Configuration);

Configure

Name the project, then map each configuration key to the secret that holds its value, under Secrets:Gcp:Map. The key keeps its own colons, so in environment variables each becomes __:

Secrets__Gcp__Project=my-clinic
Secrets__Gcp__Map__JWT__Key=barakocms-jwt-key
Secrets__Gcp__Map__Secrets__Key=barakocms-secrets-key
Secrets__Gcp__Map__Mfa__Key=projects/shared-keys/secrets/mfa/versions/3

A short name reads the latest version of that secret in Secrets:Gcp:Project. A full name, projects/<project>/secrets/<secret> or with /versions/<n>, is used as it is, so a pinned version or another project works without the project setting. The payload is read as UTF-8 text and becomes the value of its key. A mapped value wins over the same key set anywhere else, and in the published image a key mapped under both Secrets:Aws:Map and Secrets:Gcp:Map takes the Google value, the source added second. The service account needs roles/secretmanager.secretAccessor on those secrets.

When a secret cannot be read

Startup stops. A secret that does not exist, is empty, or cannot be read (permission denied, no credentials, no network within 30 seconds) throws, and the message names the secret and the key it was for, never a value. A short name with no project set stops startup before anything is asked.

That is deliberate: a host that started without JWT:Key or Secrets:Key would either refuse every token or encrypt with the wrong key.

What it does not do

Rotation. Changing Secrets:Key, Connectors:Key or Mfa:Key still makes the values encrypted under the old key unreadable, as SECURITY.md says; loading the key from a vault does not change that. Values are read once, at startup; a restart picks up a new version.

Google Secret Manager's free tier covers 6 active secret versions and 10,000 access operations a month, which a barakoCMS instance reading four keys at each start stays well inside. See BarakoCMS.Secrets.Aws for AWS Secrets Manager.

License

MIT © BaryoDev

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
5.0.0 70 10/14/2026