Fixed mail template storage access, added docker image default resources

This commit is contained in:
Marcel Baumgartner 2023-04-14 15:02:17 +02:00
parent 64bc1d3e8f
commit 1d4ae8d26d
2 changed files with 5 additions and 3 deletions

View file

@ -3,6 +3,7 @@ using System.Net.Mail;
using Logging.Net;
using Moonlight.App.Database.Entities;
using Moonlight.App.Exceptions;
using Moonlight.App.Helpers;
namespace Moonlight.App.Services;
@ -31,13 +32,13 @@ public class MailService
Action<Dictionary<string, string>> values
)
{
if (!File.Exists($"resources/mail/{name}.html"))
if (!File.Exists(PathBuilder.File("storage", "resources", "mail", $"{name}.html")))
{
Logger.Warn($"Mail template '{name}' not found. Make sure to place one in the resources folder");
throw new DisplayException("Mail template not found");
}
var rawHtml = await File.ReadAllTextAsync($"resources/mail/{name}.html");
var rawHtml = await File.ReadAllTextAsync(PathBuilder.File("storage", "resources", "mail", $"{name}.html"));
var val = new Dictionary<string, string>();
values.Invoke(val);

View file

@ -19,6 +19,7 @@ RUN dotnet publish "Moonlight.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN mkdir /app/storage
RUN mkdir -p /app/storage
RUN rm -r /app/storage/*
COPY "Moonlight/defaultstorage" "/app/defaultstorage"
ENTRYPOINT ["dotnet", "Moonlight.dll"]