feat: add sub path for actual url
This commit is contained in:
@ -61,15 +61,18 @@ public static class EnvironmentConfiguration
|
||||
.AddInMemoryCollection(environmentVariables!)
|
||||
.AddInMemoryCollection(variablesFromFile!);
|
||||
|
||||
if (variablesFromFile.TryGetValue("PATH_TO_SAVE", out var pathToSave))
|
||||
{
|
||||
Environment.SetEnvironmentVariable("PATH_TO_SAVE", pathToSave);
|
||||
if (!Directory.Exists(pathToSave))
|
||||
Directory.CreateDirectory(pathToSave);
|
||||
}
|
||||
|
||||
if (variablesFromFile.TryGetValue("ACTUAL_SUB_PATH", out var actualSubPath))
|
||||
Environment.SetEnvironmentVariable("ACTUAL_SUB_PATH", actualSubPath);
|
||||
|
||||
|
||||
if (!variablesFromFile.TryGetValue("PATH_TO_SAVE", out var data))
|
||||
return result.Build();
|
||||
|
||||
Environment.SetEnvironmentVariable("PATH_TO_SAVE", data);
|
||||
if (!Directory.Exists(data))
|
||||
Directory.CreateDirectory(data);
|
||||
if (variablesFromFile.TryGetValue("SWAGGER_SUB_PATH", out var swaggerSubPath))
|
||||
Environment.SetEnvironmentVariable("SWAGGER_SUB_PATH", swaggerSubPath);
|
||||
|
||||
return result.Build();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Mirea.Api.Endpoint.Common.Services;
|
||||
using Mirea.Api.Endpoint.Configuration.Swagger;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using System;
|
||||
@ -65,6 +66,7 @@ public static class SwaggerConfiguration
|
||||
var url = $"/swagger/{description.GroupName}/swagger.json";
|
||||
var name = description.GroupName.ToUpperInvariant();
|
||||
options.SwaggerEndpoint(url, name);
|
||||
options.RoutePrefix = UrlHelper.GetSubPathSwagger.Trim('/');
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user