Added /configuration volume with support for config.json and config.yml

This commit is contained in:
Mia Rose Winter 2024-01-18 13:56:52 +01:00
parent 76183c17a2
commit 3cdb9c3cc8
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
4 changed files with 8 additions and 1 deletions

View file

@ -5,6 +5,7 @@ USER app
WORKDIR /app
RUN mkdir ./files && chown app ./files
VOLUME /app/files
VOLUME /configuration
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

View file

@ -9,7 +9,10 @@
using Wave.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddEnvironmentVariables("WAVE_");
builder.Configuration
.AddEnvironmentVariables("WAVE_")
.AddJsonFile("/configuration/config.json", true, false)
.AddYamlFile("/configuration/config.yml", true, false);
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddControllers();

View file

@ -22,6 +22,7 @@
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
</ItemGroup>

View file

@ -16,6 +16,7 @@ services:
- "WAVE_ConnectionStrings__DefaultConnection=Host=db; Username=wave; Password=development"
volumes:
- wave-files:/app/files
- wave-config:/configuration
networks:
- wave
database:
@ -32,6 +33,7 @@ services:
volumes:
wave-files:
wave-config:
wave-db:
networks:
wave: