Extensions.Configuration.GitRepository 1.0.30

dotnet add package Extensions.Configuration.GitRepository --version 1.0.30
                    
NuGet\Install-Package Extensions.Configuration.GitRepository -Version 1.0.30
                    
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="Extensions.Configuration.GitRepository" Version="1.0.30" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Extensions.Configuration.GitRepository" Version="1.0.30" />
                    
Directory.Packages.props
<PackageReference Include="Extensions.Configuration.GitRepository" />
                    
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 Extensions.Configuration.GitRepository --version 1.0.30
                    
#r "nuget: Extensions.Configuration.GitRepository, 1.0.30"
                    
#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.
#addin nuget:?package=Extensions.Configuration.GitRepository&version=1.0.30
                    
Install Extensions.Configuration.GitRepository as a Cake Addin
#tool nuget:?package=Extensions.Configuration.GitRepository&version=1.0.30
                    
Install Extensions.Configuration.GitRepository as a Cake Tool

IoTSharp/Extensions.Configuration.GitRepository

Project Overview

Git repository configuration provider is a library designed for managing and loading configuration files, specifically for C# developers. It allows developers to read configuration files directly from a Git repository, enabling centralized configuration management and version control in distributed systems or microservice architectures.

Build status NuGet Count Issues Open NuGet Version

Configuration Providers

This project now supports fetching configuration files from the following platforms:

  • Gitee.com NuGet Version NuGet Count
  • GitLab NuGet Version NuGet Count
  • Gitea NuGet Version NuGet Count
  • GitHub NuGet Version NuGet Count

With this feature, you can directly retrieve configuration files from repositories hosted on these platforms, making it easier to manage and load configurations in multi-platform environments.

Key Features

  • Load Configuration from Git Repositories: Allows you to load configuration files from a specified Git repository, supporting various formats (such as JSON, YAML, etc.).
  • Version Control: Leverage Git's powerful features to easily track changes to configuration files, ensuring traceability and version management.
  • Dynamic Refresh: Supports dynamic refresh of configuration files, automatically updating configurations when files in the Git repository change.
  • Flexible Configuration Sources: Supports loading configurations from multiple branches or tags, adapting to different environments (development, testing, production).
  • Security: Access Git repositories via SSH or HTTPS, ensuring secure transmission and access control of configuration files.

Use Cases

  • Distributed Systems: Centrally manage and distribute configuration files in distributed systems, ensuring consistency and manageability across services.
  • Microservice Architecture: Simplify configuration management in a microservice architecture by unifying configuration file management through a Git repository.
  • Dynamic Configuration Management: Suitable for scenarios requiring dynamic configuration updates, such as applications with frequently changing configuration files.
  • Version Control: Utilize Git's version control features to ensure traceability and change management in scenarios requiring strict version control.

Installation and Usage

Installation

You can install this library via the NuGet package manager. Run the following command to install:

dotnet add package Extensions.Configuration.GitRepository
Example Code

Here is a simple example demonstrating how to use this library to load configuration files from a Git repository:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddOpenApi();
builder.Configuration.AddUserSecrets("personal_access_tokens");
builder.Configuration.AddGitRepository(cfg => cfg.WithGitLab()
                                                .WithHostUrl("https://git.uixe.net/")
                                                .WithRepositoryPath("uixe/stdlanedevctlsvr")
                                                .WithAuthenticationToken(builder.Configuration.GetValue<string>("personal_access_tokens"))
                                                .WithFileName($"{Environment.GetEnvironmentVariable("UIXEID")}/appsettings.{builder.Environment.EnvironmentName}.json")
                                                .WithCache($"{builder.Environment.ContentRootPath}{System.IO.Path.DirectorySeparatorChar}appsettings.{builder.Environment.EnvironmentName}.json")
                                        );

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
}
Console.WriteLine($"abc={app.Configuration.GetValue<string>("abc")}");
app.UseAuthorization();
app.MapControllers();
app.Run();
}

Contribution Guidelines

We welcome community contributions. You can contribute in the following ways:

  • Report Issues: Report bugs or suggest features on the GitHub Issues page.
  • Submit PRs: Fix bugs or add new features and submit your code through a Pull Request.
  • Improve Documentation: Help improve the project's documentation to make it clearer and more understandable.

License

This project is licensed under the MIT License. For details, please refer to the LICENSE file.

Acknowledgments

Inspired by https://github.com/denis-ivanov/Extensions.Configuration.GitLab

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Extensions.Configuration.GitRepository:

Package Downloads
Extensions.Configuration.GitRepository.GitHubProvider

GitHub's repository and gist configuration provider implementation to use with Microsoft.Extensions.Configuration.

Extensions.Configuration.GitRepository.GiteaProvider

Gitea's repository configuration provider implementation to use with Microsoft.Extensions.Configuration.

Extensions.Configuration.GitRepository.GiteeProvider

Gitee's repository and gist configuration provider implementation to use with Microsoft.Extensions.Configuration.

Extensions.Configuration.GitRepository.GitLabProvider

GitLab's repository configuration provider implementation to use with Microsoft.Extensions.Configuration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.30 190 10 days ago
1.0.29 197 11 days ago
1.0.28 196 11 days ago
1.0.26 194 11 days ago
1.0.22 209 13 days ago
1.0.17 137 a month ago
1.0.16 90 a month ago
1.0.15 107 a month ago
1.0.14 110 a month ago
1.0.8 113 a month ago
1.0.6 121 a month ago