Archetypical.Software.Configuration.Manager
0.2.2
dotnet add package Archetypical.Software.Configuration.Manager --version 0.2.2
NuGet\Install-Package Archetypical.Software.Configuration.Manager -Version 0.2.2
<PackageReference Include="Archetypical.Software.Configuration.Manager" Version="0.2.2" />
<PackageVersion Include="Archetypical.Software.Configuration.Manager" Version="0.2.2" />
<PackageReference Include="Archetypical.Software.Configuration.Manager" />
paket add Archetypical.Software.Configuration.Manager --version 0.2.2
#r "nuget: Archetypical.Software.Configuration.Manager, 0.2.2"
#addin nuget:?package=Archetypical.Software.Configuration.Manager&version=0.2.2
#tool nuget:?package=Archetypical.Software.Configuration.Manager&version=0.2.2
Archetypical.Software.Configuration
Config service backed by Github.
Getting Started
Instructions to get started with this project.
Usage
How to use your project.
Configuration
This service requires configuration for connecting to the Git repository where configuration files are stored. This configuration is typically placed in appsettings.json
or provided through environment variables.
Git Repository Settings (Git
section)
The core settings are within the "Git"
section of your configuration.
{
"Git": {
"RepositoryUrl": "<your-git-repository-url>",
"AuthenticationType": "<authentication-method>",
// ... other auth-specific settings
}
}
RepositoryUrl
: The URL of the Git repository (HTTPS or SSH).AuthenticationType
: Specifies the method used to authenticate with the Git repository. Valid values are:UsernamePassword
Pat
(Personal Access Token)Ssh
GitHubApp
(Requires external token generation, see below)
Authentication Methods
1. Username and Password
Use your Git provider username and password (or an app-specific password if 2FA is enabled).
{
"Git": {
"RepositoryUrl": "https://github.com/your-username/your-repo.git",
"AuthenticationType": "UsernamePassword",
"Username": "your-github-username",
"Password": "your-github-password"
}
}
2. Personal Access Token (PAT)
Use a PAT generated from your Git provider (e.g., GitHub Developer Settings).
{
"Git": {
"RepositoryUrl": "https://github.com/your-username/your-repo.git",
"AuthenticationType": "Pat",
// Username might be your actual username or a placeholder like "oauth2" depending on the provider
"Username": "your-github-username",
"Password": "your-github-pat" // The PAT itself goes in the Password field
}
}
3. SSH Key
Use SSH key pair authentication. Ensure the public key is added to your Git provider and the application has access to the private key file.
{
"Git": {
// Use the SSH URL format
"RepositoryUrl": "git@github.com:your-username/your-repo.git",
"AuthenticationType": "Ssh",
"SshUsername": "git", // Usually 'git' for GitHub/GitLab/Bitbucket
"SshPublicKeyPath": "/path/to/your/.ssh/id_rsa.pub", // Absolute path to public key
"SshPrivateKeyPath": "/path/to/your/.ssh/id_rsa", // Absolute path to private key
"SshPassphrase": null // Or "your-passphrase" if the private key is encrypted
}
}
Note: Ensure the file paths are correct and the application has read permissions for the key files.
4. GitHub App
This method uses a dedicated service (IGitHubAppTokenProvider
) to handle the generation, caching, and refreshing of GitHub App installation tokens.
How it works:
- The
GitHubAppTokenProvider
service (registered as a singleton) is responsible for using your App's credentials (App ID, Installation ID, Private Key) to obtain installation tokens from the GitHub API using theOctokit
library. - This service caches the token and handles refreshing it before it expires.
- When cloning or fetching, the Git credential handler requests the current cached token from the
IGitHubAppTokenProvider
service. - This token is then used like a PAT for the Git operation.
Configuration:
Set AuthenticationType
to GitHubApp
and provide the necessary App details.
{
"Git": {
"RepositoryUrl": "https://github.com/your-username/your-repo.git",
"AuthenticationType": "GitHubApp",
"GitHubAppId": 12345, // Your GitHub App's ID
"GitHubAppPrivateKeyPath": "/path/to/your/app.private-key.pem", // Absolute path to the App's private key file
"GitHubAppInstallationId": 98765 // The ID of the installation of your App on the target repository/organization
// Username and Password fields are not used for this type
}
}
Important Implementation Note:
The core logic for generating, caching, and refreshing the token within Services/GitHubAppTokenProvider.cs
needs to be fully implemented. The current code provides the structure but contains placeholders for the actual Octokit
calls and refresh mechanism.
Security: Treat the GitHub App private key file (.pem
) as highly sensitive. Ensure it is stored securely and is not committed to version control.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.4)
- Microsoft.Extensions.Configuration.Json (>= 9.0.4)
- Microsoft.Extensions.Http (>= 9.0.4)
-
net9.0
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.4)
- Microsoft.Extensions.Configuration.Json (>= 9.0.4)
- Microsoft.Extensions.Http (>= 9.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Archetypical.Software.Configuration.Manager:
Package | Downloads |
---|---|
Archetypical.Software.Vega.Api.Abstractions
This package provides a turn-key API and DBContext for any REST and ODATA exposed data models. These models also allow for automated DBContexts across multiple db technologies. Full OTEL support and swagger/redoc tooling |
GitHub repositories
This package is not used by any popular GitHub repositories.