From 3cdb9c3cc8e8c4e48a7091a1eaa478db74b2c0fc Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Thu, 18 Jan 2024 13:56:52 +0100 Subject: [PATCH] Added /configuration volume with support for config.json and config.yml --- Wave/Dockerfile | 1 + Wave/Program.cs | 5 ++++- Wave/Wave.csproj | 1 + docker-compose.yml | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Wave/Dockerfile b/Wave/Dockerfile index 5588412..3be05ed 100644 --- a/Wave/Dockerfile +++ b/Wave/Dockerfile @@ -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 diff --git a/Wave/Program.cs b/Wave/Program.cs index 33abb25..e4632ba 100644 --- a/Wave/Program.cs +++ b/Wave/Program.cs @@ -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(); diff --git a/Wave/Wave.csproj b/Wave/Wave.csproj index 85353bb..4fc765a 100644 --- a/Wave/Wave.csproj +++ b/Wave/Wave.csproj @@ -22,6 +22,7 @@ + diff --git a/docker-compose.yml b/docker-compose.yml index 19db5f8..a3c4b7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: \ No newline at end of file