Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Signal9.Agent.Functions/Signal9.Agent.Functions.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>Signal9.Agent.Functions</AssemblyName>
<RootNamespace>Signal9.Agent.Functions</RootNamespace>
<LangVersion>default</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.5" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.SignalRService" Version="1.7.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Azure.Identity" Version="1.11.4" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
</ItemGroup>

Expand Down
39 changes: 0 additions & 39 deletions src/Signal9.Agent.Functions/Signal9.RMM.Functions.csproj

This file was deleted.

32 changes: 23 additions & 9 deletions src/Signal9.Agent/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,53 @@
using Microsoft.Extensions.Configuration;
using Signal9.Agent.Services;
using Signal9.Shared.Configuration;
using System.Text.Json;

var builder = Host.CreateApplicationBuilder(args);

// Add configuration
// Add configuration with .NET 9 enhancements
builder.Configuration
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
.AddEnvironmentVariables()
.AddUserSecrets<Program>(optional: true);

// Add logging
// Add enhanced logging with .NET 9 structured logging
builder.Services.AddLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
if (OperatingSystem.IsWindows())

// Add structured logging with .NET 9 improvements
logging.AddSimpleConsole(options =>
{
logging.AddEventLog();
}
options.IncludeScopes = true;
options.SingleLine = true;
options.TimestampFormat = "[yyyy-MM-dd HH:mm:ss] ";
});
});

// Add configuration options
// Add configuration options with validation
builder.Services.Configure<AgentConfiguration>(
builder.Configuration.GetSection("AgentConfiguration"));

// Add services
// Add services with .NET 9 performance improvements
builder.Services.AddSingleton<ITelemetryCollector, TelemetryCollector>();
builder.Services.AddSingleton<ISystemInfoProvider, SystemInfoProvider>();
builder.Services.AddHostedService<AgentService>();

// Add HttpClient with .NET 9 optimizations
builder.Services.AddHttpClient("Signal9Api", client =>
{
client.BaseAddress = new Uri(builder.Configuration["Signal9Api:BaseUrl"] ?? "https://api.signal9.com");
client.Timeout = TimeSpan.FromSeconds(30);
});

var host = builder.Build();

// Create logger for startup
var logger = host.Services.GetRequiredService<ILogger<Program>>();
logger.LogInformation("Signal9 Agent starting up");
logger.LogInformation("Signal9 Agent starting up with .NET 9 optimizations");

try
{
Expand All @@ -51,4 +64,5 @@
finally
{
logger.LogInformation("Signal9 Agent shutting down");
await host.StopAsync();
}
Loading
Loading