Shared.Infra.Core
1.0.4
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
<PackageReference Include="Shared.Infra.Core" Version="1.0.4" />
<PackageVersion Include="Shared.Infra.Core" Version="1.0.4" />
<PackageReference Include="Shared.Infra.Core" />
paket add Shared.Infra.Core --version 1.0.4
#r "nuget: Shared.Infra.Core, 1.0.4"
#:package Shared.Infra.Core@1.0.4
#addin nuget:?package=Shared.Infra.Core&version=1.0.4
#tool nuget:?package=Shared.Infra.Core&version=1.0.4
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
GitHub • LinkedIn
📄 Licença
Este projeto é distribuído sob a licença MIT.
| 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 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. |
-
net8.0
- Consul (>= 1.6.10.7)
- Microsoft.Extensions.Http (>= 8.0.1)
- Newtonsoft.Json (>= 13.0.3)
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 |