ConfigFerret.GitHub
0.2.0
dotnet add package ConfigFerret.GitHub --version 0.2.0
NuGet\Install-Package ConfigFerret.GitHub -Version 0.2.0
<PackageReference Include="ConfigFerret.GitHub" Version="0.2.0" />
<PackageVersion Include="ConfigFerret.GitHub" Version="0.2.0" />
<PackageReference Include="ConfigFerret.GitHub" />
paket add ConfigFerret.GitHub --version 0.2.0
#r "nuget: ConfigFerret.GitHub, 0.2.0"
#:package ConfigFerret.GitHub@0.2.0
#addin nuget:?package=ConfigFerret.GitHub&version=0.2.0
#tool nuget:?package=ConfigFerret.GitHub&version=0.2.0
ConfigFerret.GitHub
Adds GitHub Actions variables to ConfigFerret traces, so a value read from an environment variable, a Kubernetes env entry or a ConfigMap key is traced back to the organization, repository or environment variable (or secret) that set it.
dotnet add package ConfigFerret.GitHub
using ConfigFerret;
using ConfigFerret.GitHub;
var github = await GitHubVariables.LoadAsync(new GitHubVariablesOptions
{
Owner = "contoso",
Repository = "api",
Environment = "production", // optional
Token = Environment.GetEnvironmentVariable("GITHUB_TOKEN"), // never hard-code it
});
var report = ConfigTracer.For(builder.Configuration)
.WithGitHub(github, o => o.AddWorkflow(".github/workflows/deploy.yml"))
.Trace();
Console.WriteLine(report.Explain("Db:Timeout"));
// set in environment variable Db__Timeout from GitHub environment variable DB_TIMEOUT
Configure from appsettings and dependency injection
Put everything except the token in configuration, and register the source:
// appsettings.json: no token here
{
"ConfigFerret": {
"GitHub": {
"Owner": "contoso",
"Repository": "api",
"Environment": "production",
"Workflows": [ ".github/workflows/deploy.yml" ],
"Links": { "Db__Timeout": "DB_TIMEOUT", "Db__Password": "secrets.DB_PASSWORD" }
}
}
}
builder.Services.AddConfigFerretGitHub(builder.Configuration.GetSection("ConfigFerret:GitHub"));
var app = builder.Build();
var tracer = ConfigTracer.For(builder.Configuration);
await tracer.WithGitHubAsync(app.Services);
Console.WriteLine(tracer.Trace().Explain("Db:Timeout"));
Supply the token from somewhere that is not committed:
dotnet user-secrets set "ConfigFerret:GitHub:Token" "<token>" # development
export ConfigFerret__GitHub__Token="<token>" # CI, containers
or from a key vault configuration provider. In a GitHub Actions workflow, map the built-in token:
env: ConfigFerret__GitHub__Token: ${{ secrets.GITHUB_TOKEN }}.
Every property of GitHubVariablesOptions and GitHubTraceOptions binds from the section (ApiBaseAddress,
IncludeOrganization, IncludeSecrets, MatchByName and so on). In Links, prefix a value with secrets. to link to
a secret. A workflow in Workflows that cannot be read becomes a trace warning.
When the host starts, the options are checked, and startup fails with a message naming the key when:
Owner,RepositoryorTokenis missing,ApiBaseAddressis not HTTPS (or holds credentials),- the token is in any
appsettings*.jsonfile, even one that another source overrides, since that file is usually committed. User secrets (secrets.json), environment variables and key vaults are fine.
The messages never include the token. Without a host, the same checks run the first time the options are read.
How layers are linked
- Workflow files (
AddWorkflow): everyNAME: ${{ vars.X }}orNAME: ${{ secrets.X }}line linksNAMEtoX. - Explicit links (
Map("Db__Timeout", "DB_TIMEOUT")). - Same name (on by default,
MatchByName): an environment variable, env entry or ConfigMap/Secret key with the same name as a GitHub variable (or, failing that, a secret). These links are marked as inferred.
Organization, repository and environment entries are listed lowest priority first, the same order GitHub applies them, so the environment one wins.
Tokens and secrets
- The token needs read access to Actions variables (fine-grained: "Variables: read", plus "Secrets: read" for secret
names and "Environments: read" for environments). In a workflow,
GITHUB_TOKENwithactions: readworks. - The token is sent only in the
Authorizationheader, only over HTTPS, and redirects are not followed. It never appears in a report or an exception message. - GitHub never returns secret values, so secrets show up by name only and are marked sensitive. The usual ConfigFerret redaction then hides the value of every layer in that chain.
- Organization entries need an organization-owned repository; when they cannot be read, the trace carries a warning instead of failing.
For GitHub Enterprise Server, set ApiBaseAddress to https://HOST/api/v3/.
| Product | Versions 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. net11.0 is compatible. |
-
net10.0
- ConfigFerret (>= 0.2.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.15)
-
net11.0
- ConfigFerret (>= 0.2.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 11.0.0)
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 |
|---|---|---|
| 0.2.0 | 104 | 11/13/2026 |