diff --git a/DysonNetwork.Control/AppHost.cs b/DysonNetwork.Control/AppHost.cs index 36ca30f..ecc737f 100644 --- a/DysonNetwork.Control/AppHost.cs +++ b/DysonNetwork.Control/AppHost.cs @@ -2,50 +2,62 @@ using Aspire.Hosting.Yarp.Transforms; var builder = DistributedApplication.CreateBuilder(args); -var database = builder.AddPostgres("database"); +// Database was configured separately in each service. +// var database = builder.AddPostgres("database"); + var cache = builder.AddConnectionString("cache"); var queue = builder.AddNats("queue").WithJetStream(); var ringService = builder.AddProject("ring") - .WithReference(database) .WithReference(queue); var passService = builder.AddProject("pass") - .WithReference(database) .WithReference(cache) .WithReference(queue) .WithReference(ringService); var driveService = builder.AddProject("drive") - .WithReference(database) .WithReference(cache) .WithReference(queue) - .WithReference(passService); + .WithReference(passService) + .WithReference(ringService); var sphereService = builder.AddProject("sphere") - .WithReference(database) .WithReference(cache) .WithReference(queue) - .WithReference(passService); + .WithReference(passService) + .WithReference(ringService); var developService = builder.AddProject("develop") - .WithReference(database) .WithReference(cache) - .WithReference(passService); + .WithReference(passService) + .WithReference(ringService); + +// Extra double-ended references +ringService.WithReference(passService); var gateway = builder.AddYarp("gateway") .WithHostPort(5000) .WithConfiguration(yarp => { - yarp.AddRoute("/ring/{**catch-all}", ringService) + var ringCluster = yarp.AddCluster(ringService.GetEndpoint("http")); + yarp.AddRoute("/ws", ringCluster); + yarp.AddRoute("/ring/{**catch-all}", ringCluster) .WithTransformPathRemovePrefix("/ring") .WithTransformPathPrefix("/api"); - yarp.AddRoute("/id/{**catch-all}", passService) + var passCluster = yarp.AddCluster(passService.GetEndpoint("http")); + yarp.AddRoute("/.well-known/openid-configuration", passCluster); + yarp.AddRoute("/.well-known/jwks", passCluster); + yarp.AddRoute("/id/{**catch-all}", passCluster) .WithTransformPathRemovePrefix("/id") .WithTransformPathPrefix("/api"); - yarp.AddRoute("/drive/{**catch-all}", driveService) + var driveCluster = yarp.AddCluster(driveService.GetEndpoint("http")); + yarp.AddRoute("/api/tus", driveCluster); + yarp.AddRoute("/drive/{**catch-all}", driveCluster) .WithTransformPathRemovePrefix("/drive") .WithTransformPathPrefix("/api"); - yarp.AddRoute("/sphere/{**catch-all}", sphereService) + var sphereCluster = yarp.AddCluster(sphereService.GetEndpoint("http")); + yarp.AddRoute("/sphere/{**catch-all}", sphereCluster) .WithTransformPathRemovePrefix("/sphere") .WithTransformPathPrefix("/api"); - yarp.AddRoute("/develop/{**catch-all}", developService) + var developCluster = yarp.AddCluster(developService.GetEndpoint("http")); + yarp.AddRoute("/develop/{**catch-all}", developCluster) .WithTransformPathRemovePrefix("/develop") .WithTransformPathPrefix("/api"); }); diff --git a/DysonNetwork.Control/DysonNetwork.Control.csproj b/DysonNetwork.Control/DysonNetwork.Control.csproj index 7ca99c2..20416d3 100644 --- a/DysonNetwork.Control/DysonNetwork.Control.csproj +++ b/DysonNetwork.Control/DysonNetwork.Control.csproj @@ -21,7 +21,6 @@ - diff --git a/DysonNetwork.Develop/Properties/launchSettings.json b/DysonNetwork.Develop/Properties/launchSettings.json index 92cb95a..32476e3 100644 --- a/DysonNetwork.Develop/Properties/launchSettings.json +++ b/DysonNetwork.Develop/Properties/launchSettings.json @@ -9,6 +9,15 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7192;http://localhost:5156", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } diff --git a/DysonNetwork.Drive/Properties/launchSettings.json b/DysonNetwork.Drive/Properties/launchSettings.json index 3e3be25..d4fe22b 100644 --- a/DysonNetwork.Drive/Properties/launchSettings.json +++ b/DysonNetwork.Drive/Properties/launchSettings.json @@ -9,6 +9,15 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7092;http://localhost:5090", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } diff --git a/DysonNetwork.Gateway/Controllers/WellKnownController.cs b/DysonNetwork.Gateway/Controllers/WellKnownController.cs deleted file mode 100644 index 5523c8f..0000000 --- a/DysonNetwork.Gateway/Controllers/WellKnownController.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Text; -using System.Text.Json.Serialization; -using dotnet_etcd.interfaces; -using Microsoft.AspNetCore.Mvc; -using Yarp.ReverseProxy.Configuration; - -namespace DysonNetwork.Gateway.Controllers; - -[ApiController] -[Route("/.well-known")] -public class WellKnownController( - IConfiguration configuration, - IProxyConfigProvider proxyConfigProvider, - IEtcdClient etcdClient) - : ControllerBase -{ - public class IpCheckResponse - { - [JsonPropertyName("remote_ip")] public string? RemoteIp { get; set; } - [JsonPropertyName("x_forwarded_for")] public string? XForwardedFor { get; set; } - [JsonPropertyName("x_forwarded_proto")] public string? XForwardedProto { get; set; } - [JsonPropertyName("x_forwarded_host")] public string? XForwardedHost { get; set; } - [JsonPropertyName("x_real_ip")] public string? XRealIp { get; set; } - } - - [HttpGet("ip-check")] - public ActionResult GetIpCheck() - { - var ip = HttpContext.Connection.RemoteIpAddress?.ToString(); - - var xForwardedFor = Request.Headers["X-Forwarded-For"].FirstOrDefault(); - var xForwardedProto = Request.Headers["X-Forwarded-Proto"].FirstOrDefault(); - var xForwardedHost = Request.Headers["X-Forwarded-Host"].FirstOrDefault(); - var realIp = Request.Headers["X-Real-IP"].FirstOrDefault(); - - return Ok(new IpCheckResponse - { - RemoteIp = ip, - XForwardedFor = xForwardedFor, - XForwardedProto = xForwardedProto, - XForwardedHost = xForwardedHost, - XRealIp = realIp - }); - } - - [HttpGet("domains")] - public IActionResult GetDomainMappings() - { - var domainMappings = configuration.GetSection("DomainMappings").GetChildren() - .ToDictionary(x => x.Key, x => x.Value); - return Ok(domainMappings); - } - - [HttpGet("services")] - public IActionResult GetServices() - { - var local = configuration.GetValue("LocalMode"); - var response = etcdClient.GetRange("/services/"); - var kvs = response.Kvs; - - var serviceMap = kvs.ToDictionary( - kv => Encoding.UTF8.GetString(kv.Key.ToByteArray()).Replace("/services/", ""), - kv => Encoding.UTF8.GetString(kv.Value.ToByteArray()) - ); - - if (local) return Ok(serviceMap); - - var domainMappings = configuration.GetSection("DomainMappings").GetChildren() - .ToDictionary(x => x.Key, x => x.Value); - foreach (var (key, _) in serviceMap.ToList()) - { - if (!domainMappings.TryGetValue(key, out var domain)) continue; - if (domain is not null) - serviceMap[key] = "http://" + domain; - } - - return Ok(serviceMap); - } - - [HttpGet("routes")] - public IActionResult GetProxyRules() - { - var config = proxyConfigProvider.GetConfig(); - var rules = config.Routes.Select(r => new - { - r.RouteId, - r.ClusterId, - Match = new - { - r.Match.Path, - Hosts = r.Match.Hosts != null ? string.Join(", ", r.Match.Hosts) : null - }, - Transforms = r.Transforms?.Select(t => t.Select(kv => $"{kv.Key}: {kv.Value}").ToList()) - }).ToList(); - - var clusters = config.Clusters.Select(c => new - { - c.ClusterId, - Destinations = c.Destinations?.Select(d => new - { - d.Key, - d.Value.Address - }).ToList() - }).ToList(); - - return Ok(new { Rules = rules, Clusters = clusters }); - } -} \ No newline at end of file diff --git a/DysonNetwork.Gateway/Dockerfile b/DysonNetwork.Gateway/Dockerfile deleted file mode 100644 index b9273da..0000000 --- a/DysonNetwork.Gateway/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base -USER $APP_UID -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 - -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["DysonNetwork.Gateway/DysonNetwork.Gateway.csproj", "DysonNetwork.Gateway/"] -RUN dotnet restore "DysonNetwork.Gateway/DysonNetwork.Gateway.csproj" -COPY . . -WORKDIR "/src/DysonNetwork.Gateway" -RUN dotnet build "./DysonNetwork.Gateway.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./DysonNetwork.Gateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "DysonNetwork.Gateway.dll"] \ No newline at end of file diff --git a/DysonNetwork.Gateway/DysonNetwork.Gateway.csproj b/DysonNetwork.Gateway/DysonNetwork.Gateway.csproj deleted file mode 100644 index 47c67dc..0000000 --- a/DysonNetwork.Gateway/DysonNetwork.Gateway.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - diff --git a/DysonNetwork.Gateway/Program.cs b/DysonNetwork.Gateway/Program.cs deleted file mode 100644 index 0bf2a37..0000000 --- a/DysonNetwork.Gateway/Program.cs +++ /dev/null @@ -1,40 +0,0 @@ -using DysonNetwork.Gateway.Startup; -using DysonNetwork.Shared.Http; -using Microsoft.AspNetCore.HttpOverrides; - -var builder = WebApplication.CreateBuilder(args); - -builder.AddServiceDefaults(); - -builder.Host.UseContentRoot(Directory.GetCurrentDirectory()); -builder.WebHost.ConfigureKestrel(options => -{ - options.Limits.MaxRequestBodySize = long.MaxValue; - options.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(2); - options.Limits.RequestHeadersTimeout = TimeSpan.FromSeconds(30); -}); - -// Add services to the container. -builder.Services.AddGateway(builder.Configuration); -builder.Services.AddControllers(); - -var app = builder.Build(); - -app.MapDefaultEndpoints(); - -app.ConfigureForwardedHeaders(app.Configuration); - -app.UseRequestTimeouts(); -app.UseCors(opts => - opts.SetIsOriginAllowed(_ => true) - .WithExposedHeaders("*") - .WithHeaders("*") - .AllowCredentials() - .AllowAnyHeader() - .AllowAnyMethod() -); - -app.MapControllers(); -app.MapReverseProxy(); - -app.Run(); diff --git a/DysonNetwork.Gateway/Properties/launchSettings.json b/DysonNetwork.Gateway/Properties/launchSettings.json deleted file mode 100644 index 4551407..0000000 --- a/DysonNetwork.Gateway/Properties/launchSettings.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "applicationUrl": "http://localhost:5094", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "applicationUrl": "https://localhost:7034;http://0.0.0.0:5094", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/DysonNetwork.Gateway/RegistryProxyConfigProvider.cs b/DysonNetwork.Gateway/RegistryProxyConfigProvider.cs deleted file mode 100644 index 4c4bc91..0000000 --- a/DysonNetwork.Gateway/RegistryProxyConfigProvider.cs +++ /dev/null @@ -1,239 +0,0 @@ -using System.Text; -using dotnet_etcd.interfaces; -using Yarp.ReverseProxy.Configuration; -using Yarp.ReverseProxy.Forwarder; - -namespace DysonNetwork.Gateway; - -public class RegistryProxyConfigProvider : IProxyConfigProvider, IDisposable -{ - private readonly object _lock = new(); - private readonly IEtcdClient _etcdClient; - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly CancellationTokenSource _watchCts = new(); - private CancellationTokenSource _cts; - private IProxyConfig _config; - - public RegistryProxyConfigProvider( - IEtcdClient etcdClient, - IConfiguration configuration, - ILogger logger - ) - { - _etcdClient = etcdClient; - _configuration = configuration; - _logger = logger; - _cts = new CancellationTokenSource(); - _config = LoadConfig(); - - // Watch for changes in etcd - _etcdClient.WatchRange("/services/", _ => - { - _logger.LogInformation("Etcd configuration changed. Reloading proxy config."); - ReloadConfig(); - }, cancellationToken: _watchCts.Token); - } - - public IProxyConfig GetConfig() => _config; - - private void ReloadConfig() - { - lock (_lock) - { - var oldCts = _cts; - _cts = new CancellationTokenSource(); - _config = LoadConfig(); - oldCts.Cancel(); - oldCts.Dispose(); - } - } - - private IProxyConfig LoadConfig() - { - _logger.LogInformation("Generating new proxy config."); - var response = _etcdClient.GetRange("/services/"); - var kvs = response.Kvs; - - var serviceMap = kvs.ToDictionary( - kv => Encoding.UTF8.GetString(kv.Key.ToByteArray()).Replace("/services/", ""), - kv => Encoding.UTF8.GetString(kv.Value.ToByteArray()) - ); - - var clusters = new List(); - var routes = new List(); - - var domainMappings = _configuration.GetSection("DomainMappings").GetChildren() - .ToDictionary(x => x.Key, x => x.Value); - - var pathAliases = _configuration.GetSection("PathAliases").GetChildren() - .ToDictionary(x => x.Key, x => x.Value); - - var directRoutes = _configuration.GetSection("DirectRoutes").Get>() ?? - []; - - _logger.LogInformation("Indexing {ServiceCount} services from Etcd.", kvs.Count); - - var gatewayServiceName = _configuration["Service:Name"]; - - // Add direct routes - foreach (var directRoute in directRoutes) - { - if (serviceMap.TryGetValue(directRoute.Service, out var serviceUrl)) - { - var existingCluster = clusters.FirstOrDefault(c => c.ClusterId == directRoute.Service); - if (existingCluster is null) - { - var cluster = new ClusterConfig - { - ClusterId = directRoute.Service, - Destinations = new Dictionary - { - { "destination1", new DestinationConfig { Address = serviceUrl } } - }, - }; - clusters.Add(cluster); - } - - var route = new RouteConfig - { - RouteId = $"direct-{directRoute.Service}-{directRoute.Path.Replace("/", "-")}", - ClusterId = directRoute.Service, - Match = new RouteMatch { Path = directRoute.Path }, - }; - routes.Add(route); - _logger.LogInformation(" Added Direct Route: {Path} -> {Service}", directRoute.Path, - directRoute.Service); - } - else - { - _logger.LogWarning(" Direct route service {Service} not found in Etcd.", directRoute.Service); - } - } - - foreach (var serviceName in serviceMap.Keys) - { - if (serviceName == gatewayServiceName) - { - _logger.LogInformation("Skipping gateway service: {ServiceName}", serviceName); - continue; - } - - var serviceUrl = serviceMap[serviceName]; - - // Determine the path alias - string? pathAlias; - pathAlias = pathAliases.TryGetValue(serviceName, out var alias) - ? alias - : serviceName.Split('.').Last().ToLowerInvariant(); - - _logger.LogInformation(" Service: {ServiceName}, URL: {ServiceUrl}, Path Alias: {PathAlias}", serviceName, - serviceUrl, pathAlias); - - // Check if the cluster already exists - var existingCluster = clusters.FirstOrDefault(c => c.ClusterId == serviceName); - if (existingCluster == null) - { - var cluster = new ClusterConfig - { - ClusterId = serviceName, - Destinations = new Dictionary - { - { "destination1", new DestinationConfig { Address = serviceUrl } } - } - }; - clusters.Add(cluster); - _logger.LogInformation(" Added Cluster: {ServiceName}", serviceName); - } - else if (existingCluster.Destinations is not null) - { - // Create a new cluster with merged destinations - var newDestinations = new Dictionary(existingCluster.Destinations) - { - { - $"destination{existingCluster.Destinations.Count + 1}", - new DestinationConfig { Address = serviceUrl } - } - }; - - var mergedCluster = new ClusterConfig - { - ClusterId = serviceName, - Destinations = newDestinations - }; - - // Replace the existing cluster with the merged one - var index = clusters.IndexOf(existingCluster); - clusters[index] = mergedCluster; - - _logger.LogInformation(" Updated Cluster {ServiceName} with {DestinationCount} destinations", - serviceName, mergedCluster.Destinations.Count); - } - - // Host-based routing - if (domainMappings.TryGetValue(serviceName, out var domain) && domain is not null) - { - var hostRoute = new RouteConfig - { - RouteId = $"{serviceName}-host", - ClusterId = serviceName, - Match = new RouteMatch - { - Hosts = [domain], - Path = "/{**catch-all}" - }, - }; - routes.Add(hostRoute); - _logger.LogInformation(" Added Host-based Route: {Host}", domain); - } - - // Path-based routing - var pathRoute = new RouteConfig - { - RouteId = $"{serviceName}-path", - ClusterId = serviceName, - Match = new RouteMatch { Path = $"/{pathAlias}/{{**catch-all}}" }, - Transforms = new List> - { - new() { { "PathRemovePrefix", $"/{pathAlias}" } }, - new() { { "PathPrefix", "/api" } }, - }, - Timeout = TimeSpan.FromSeconds(5) - }; - routes.Add(pathRoute); - _logger.LogInformation(" Added Path-based Route: {Path}", pathRoute.Match.Path); - } - - return new CustomProxyConfig( - routes, - clusters, - new Microsoft.Extensions.Primitives.CancellationChangeToken(_cts.Token) - ); - } - - private class CustomProxyConfig( - IReadOnlyList routes, - IReadOnlyList clusters, - Microsoft.Extensions.Primitives.IChangeToken changeToken - ) - : IProxyConfig - { - public IReadOnlyList Routes { get; } = routes; - public IReadOnlyList Clusters { get; } = clusters; - public Microsoft.Extensions.Primitives.IChangeToken ChangeToken { get; } = changeToken; - } - - public record DirectRouteConfig - { - public required string Path { get; set; } - public required string Service { get; set; } - } - - public virtual void Dispose() - { - _cts.Cancel(); - _cts.Dispose(); - _watchCts.Cancel(); - _watchCts.Dispose(); - } -} \ No newline at end of file diff --git a/DysonNetwork.Gateway/Startup/ServiceCollectionExtensions.cs b/DysonNetwork.Gateway/Startup/ServiceCollectionExtensions.cs deleted file mode 100644 index 1ac05d4..0000000 --- a/DysonNetwork.Gateway/Startup/ServiceCollectionExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Net.Security; -using Yarp.ReverseProxy.Configuration; -using Yarp.ReverseProxy.Transforms; - -namespace DysonNetwork.Gateway.Startup; - -public static class ServiceCollectionExtensions -{ - public static IServiceCollection AddGateway(this IServiceCollection services, IConfiguration configuration) - { - services.AddRequestTimeouts(); - - services - .AddReverseProxy() - .ConfigureHttpClient((context, handler) => - { - // var caCert = X509CertificateLoader.LoadCertificateFromFile(configuration["CaCert"]!); - handler.SslOptions = new SslClientAuthenticationOptions - { - RemoteCertificateValidationCallback = (sender, cert, chain, errors) => true - }; - }) - .AddTransforms(context => - { - context.CopyRequestHeaders = true; - context.AddOriginalHost(); - context.AddForwarded(action: ForwardedTransformActions.Set); - context.AddXForwarded(action: ForwardedTransformActions.Set); - }); - - services.AddSingleton(); - - return services; - } -} diff --git a/DysonNetwork.Gateway/VersionController.cs b/DysonNetwork.Gateway/VersionController.cs deleted file mode 100644 index 6040eae..0000000 --- a/DysonNetwork.Gateway/VersionController.cs +++ /dev/null @@ -1,20 +0,0 @@ -using DysonNetwork.Shared.Data; -using Microsoft.AspNetCore.Mvc; - -namespace DysonNetwork.Gateway; - -[ApiController] -[Route("/api/version")] -public class VersionController : ControllerBase -{ - [HttpGet] - public IActionResult Get() - { - return Ok(new AppVersion - { - Version = ThisAssembly.AssemblyVersion, - Commit = ThisAssembly.GitCommitId, - UpdateDate = ThisAssembly.GitCommitDate - }); - } -} diff --git a/DysonNetwork.Gateway/appsettings.json b/DysonNetwork.Gateway/appsettings.json deleted file mode 100644 index 3357c9a..0000000 --- a/DysonNetwork.Gateway/appsettings.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "LocalMode": true, - "CaCert": "../Certificates/ca.crt", - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "ConnectionStrings": { - "Etcd": "etcd.orb.local:2379" - }, - "Etcd": { - "Insecure": true - }, - "Service": { - "Name": "DysonNetwork.Gateway", - "Url": "https://localhost:7034" - }, - "DomainMappings": { - "DysonNetwork.Pass": "id.solsynth.dev", - "DysonNetwork.Drive": "drive.solsynth.dev", - "DysonNetwork.Ring": "push.solsynth.dev", - "DysonNetwork.Sphere": "sphere.solsynth.dev" - }, - "PathAliases": { - "DysonNetwork.Pass": "id", - "DysonNetwork.Drive": "drive" - }, - "DirectRoutes": [ - { - "Path": "/ws", - "Service": "DysonNetwork.Ring" - }, - { - "Path": "/api/tus", - "Service": "DysonNetwork.Drive" - }, - { - "Path": "/.well-known/openid-configuration", - "Service": "DysonNetwork.Pass" - }, - { - "Path": "/.well-known/jwks", - "Service": "DysonNetwork.Pass" - } - ] -} diff --git a/DysonNetwork.Gateway/version.json b/DysonNetwork.Gateway/version.json deleted file mode 100644 index 9fbf8d3..0000000 --- a/DysonNetwork.Gateway/version.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "1.0", - "publicReleaseRefSpec": ["^refs/heads/main$"], - "cloudBuild": { - "setVersionVariables": true - } -} diff --git a/DysonNetwork.Pass/Properties/launchSettings.json b/DysonNetwork.Pass/Properties/launchSettings.json index cf67092..23c7313 100644 --- a/DysonNetwork.Pass/Properties/launchSettings.json +++ b/DysonNetwork.Pass/Properties/launchSettings.json @@ -9,6 +9,15 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7058;http://localhost:5216", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } diff --git a/DysonNetwork.Ring/Properties/launchSettings.json b/DysonNetwork.Ring/Properties/launchSettings.json index c0f253c..982a366 100644 --- a/DysonNetwork.Ring/Properties/launchSettings.json +++ b/DysonNetwork.Ring/Properties/launchSettings.json @@ -9,6 +9,15 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7259;http://localhost:5212", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } diff --git a/DysonNetwork.ServiceDefaults/Extensions.cs b/DysonNetwork.ServiceDefaults/Extensions.cs index fbd1608..4b8dc80 100644 --- a/DysonNetwork.ServiceDefaults/Extensions.cs +++ b/DysonNetwork.ServiceDefaults/Extensions.cs @@ -19,6 +19,9 @@ public static class Extensions public static TBuilder AddServiceDefaults(this TBuilder builder) where TBuilder : IHostApplicationBuilder { + // Allow unencrypted grpc + AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); + builder.ConfigureOpenTelemetry(); builder.AddDefaultHealthChecks(); diff --git a/DysonNetwork.Shared/Http/KestrelConfiguration.cs b/DysonNetwork.Shared/Http/KestrelConfiguration.cs index b64021c..e3f0f38 100644 --- a/DysonNetwork.Shared/Http/KestrelConfiguration.cs +++ b/DysonNetwork.Shared/Http/KestrelConfiguration.cs @@ -12,7 +12,7 @@ public static class KestrelConfiguration { public static WebApplicationBuilder ConfigureAppKestrel( this WebApplicationBuilder builder, - IConfiguration configuration, + IConfiguration configuration, long maxRequestBodySize = 50 * 1024 * 1024 ) { diff --git a/DysonNetwork.Sphere/Properties/launchSettings.json b/DysonNetwork.Sphere/Properties/launchSettings.json index 0113940..a6ab6aa 100644 --- a/DysonNetwork.Sphere/Properties/launchSettings.json +++ b/DysonNetwork.Sphere/Properties/launchSettings.json @@ -9,6 +9,15 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7099;http://localhost:5071", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } diff --git a/DysonNetwork.sln b/DysonNetwork.sln index 6977d7a..30ddd02 100644 --- a/DysonNetwork.sln +++ b/DysonNetwork.sln @@ -16,8 +16,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Ring", "DysonN EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Drive", "DysonNetwork.Drive\DysonNetwork.Drive.csproj", "{8DE0B783-8852-494D-B90A-201ABBB71202}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Gateway", "DysonNetwork.Gateway\DysonNetwork.Gateway.csproj", "{19EB0086-4049-4B78-91C4-EAC37130A006}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Develop", "DysonNetwork.Develop\DysonNetwork.Develop.csproj", "{C577AA78-B11D-4076-89A6-1C7F0ECC04E2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Control", "DysonNetwork.Control\DysonNetwork.Control.csproj", "{7FFED190-51C7-4302-A8B5-96C839463458}" @@ -50,10 +48,6 @@ Global {8DE0B783-8852-494D-B90A-201ABBB71202}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DE0B783-8852-494D-B90A-201ABBB71202}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DE0B783-8852-494D-B90A-201ABBB71202}.Release|Any CPU.Build.0 = Release|Any CPU - {19EB0086-4049-4B78-91C4-EAC37130A006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19EB0086-4049-4B78-91C4-EAC37130A006}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19EB0086-4049-4B78-91C4-EAC37130A006}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19EB0086-4049-4B78-91C4-EAC37130A006}.Release|Any CPU.Build.0 = Release|Any CPU {C577AA78-B11D-4076-89A6-1C7F0ECC04E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C577AA78-B11D-4076-89A6-1C7F0ECC04E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {C577AA78-B11D-4076-89A6-1C7F0ECC04E2}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/DysonNetwork.sln.DotSettings.user b/DysonNetwork.sln.DotSettings.user index ee7b1ce..2998db0 100644 --- a/DysonNetwork.sln.DotSettings.user +++ b/DysonNetwork.sln.DotSettings.user @@ -93,6 +93,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded