Added option to disable the client hosting of the api server
This commit is contained in:
@@ -9,6 +9,12 @@ public class AppConfiguration
|
||||
public DatabaseConfig Database { get; set; } = new();
|
||||
public AuthenticationConfig Authentication { get; set; } = new();
|
||||
public DevelopmentConfig Development { get; set; } = new();
|
||||
public ClientConfig Client { get; set; } = new();
|
||||
|
||||
public class ClientConfig
|
||||
{
|
||||
public bool Enable { get; set; } = true;
|
||||
}
|
||||
|
||||
public class DatabaseConfig
|
||||
{
|
||||
|
||||
@@ -3,21 +3,31 @@ USER $APP_UID
|
||||
WORKDIR /app
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY ["Moonlight.ApiServer/Moonlight.ApiServer.csproj", "Moonlight.ApiServer/"]
|
||||
COPY ["Moonlight.Client/Moonlight.Client.csproj", "Moonlight.Client/"]
|
||||
COPY ["Moonlight.Shared/Moonlight.Shared.csproj", "Moonlight.Shared/"]
|
||||
|
||||
RUN dotnet restore "Moonlight.ApiServer/Moonlight.ApiServer.csproj"
|
||||
|
||||
COPY . .
|
||||
|
||||
WORKDIR "/src/Moonlight.ApiServer"
|
||||
|
||||
RUN dotnet build "Moonlight.ApiServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
|
||||
RUN dotnet publish "Moonlight.ApiServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
|
||||
@@ -131,11 +131,14 @@ var app = builder.Build();
|
||||
|
||||
await Startup.PrepareDatabase(app);
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseWebAssemblyDebugging();
|
||||
if (config.Client.Enable)
|
||||
{
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseWebAssemblyDebugging();
|
||||
|
||||
app.UseBlazorFrameworkFiles();
|
||||
app.UseStaticFiles();
|
||||
app.UseBlazorFrameworkFiles();
|
||||
app.UseStaticFiles();
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
@@ -184,6 +187,8 @@ foreach (var endpointStartup in endpointStartupInterfaces)
|
||||
}
|
||||
|
||||
app.MapControllers();
|
||||
app.MapFallbackToFile("index.html");
|
||||
|
||||
if(config.Client.Enable)
|
||||
app.MapFallbackToFile("index.html");
|
||||
|
||||
app.Run();
|
||||
@@ -5,6 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -131,8 +131,10 @@ else
|
||||
$"&redirect_uri={authStartData.RedirectUri}" +
|
||||
$"&response_type=code";
|
||||
|
||||
//Navigation.NavigateTo(uri, true);
|
||||
//return;
|
||||
Navigation.NavigateTo(uri, true);
|
||||
return;
|
||||
|
||||
// TODO: Make this configurable
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user