Shared.Infra.Core 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Shared.Infra.Core --version 1.0.4
                    
NuGet\Install-Package Shared.Infra.Core -Version 1.0.4
                    
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="Shared.Infra.Core" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shared.Infra.Core" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Shared.Infra.Core" />
                    
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 Shared.Infra.Core --version 1.0.4
                    
#r "nuget: Shared.Infra.Core, 1.0.4"
                    
#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 Shared.Infra.Core@1.0.4
                    
#: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=Shared.Infra.Core&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Shared.Infra.Core&version=1.0.4
                    
Install as a Cake Tool

Shared.Infra.Core 🧩

Biblioteca de infraestrutura modular para aplicações .NET, com foco em configurações distribuídas, mensageria e observabilidade.
Atualmente oferece integração simplificada com Consul para leitura e atualização automática de configurações.


🚀 Recursos atuais

✅ Integração com Consul para buscar e atualizar chaves de configuração.
✅ Cache interno com MemoryCache para reduzir chamadas ao Consul.
✅ Serviço de atualização automática (BackgroundService) que renova os valores em intervalos definidos.
✅ Suporte a injeção de dependência com IServiceCollection.


🧱 Instalação

Via .NET CLI:

dotnet add package Shared.Infra.Core

⚙️ Configuração

No Program.cs ou Startup.cs, registre o Consul com:

using Shared.Infra.Core.Consul;
using Shared.Infra.Core.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddConsulConfiguration(
    consulUrl: "http://consul-server:8500/v1/kv",
    consulToken: File.ReadAllText("/run/secrets/bureaus-external").Trim()
);

var app = builder.Build();

🧩 Exemplo de uso

using (var scope = app.Services.CreateScope())
{
    var consul = scope.ServiceProvider.GetRequiredService<ConsulServices>();
    var config = new Config();

    config.RabbitMQLogQueue = await consul.GetKeyValue("infra/shared/rabbitmq-log-queue");
    config.JwtSecret = await consul.GetKeyValue("infra/shared/jwt-secret");
    config.AuthorizerUrl = await consul.GetKeyValue("infra/shared/authorizer-url");
}

🔄 Atualização automática de configurações

A classe ConsulCacheUpdaterService é registrada automaticamente como HostedService.
Ela atualiza periodicamente as chaves configuradas no cache.

Intervalo padrão: 5 minutos (pode ser customizado).


🧰 Roadmap

Recurso Status
Integração com Consul
RabbitMQ (Publisher/Consumer base) 🔜
Métricas (Prometheus/OpenTelemetry) 🔜
Logger/Tracing integrados 🔜

🤝 Contribuições

Pull requests são bem-vindos!
Sugestões e melhorias podem ser abertas via Issues.


🧑‍💻 Autor

Thiago Silva
Desenvolvedor Back-end | C# | .NET | PostgreSQL
GitHubLinkedIn


📄 Licença

Este projeto é distribuído sob a licença MIT.

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 was computed.  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.  net10.0 was computed.  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
1.3.3 196 12/12/2025
1.3.2 194 12/12/2025
1.3.1 490 12/11/2025
1.3.0 258 12/3/2025
1.2.1 416 11/13/2025
1.2.0 351 11/13/2025
1.1.5 316 11/12/2025
1.1.4 314 11/12/2025
1.1.3 341 11/12/2025
1.1.2 350 11/11/2025
1.1.1 351 11/10/2025
1.1.0 194 11/7/2025
1.0.9 284 11/5/2025
1.0.8 278 11/3/2025
1.0.7 292 10/30/2025
1.0.6 263 10/29/2025
1.0.5 242 10/27/2025
1.0.4 219 10/24/2025
1.0.3 221 10/23/2025
1.0.2 238 10/23/2025
Loading failed