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