Skip to content

Commit

Permalink
use envsubst to automatically replace env variables in the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mick Vermeulen authored and Mick Vermeulen committed Sep 12, 2020
1 parent 8637ca2 commit 871731f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ DATABASE_PORT=5432
REDIS_PORT=6379
ADMINER_PORT=8080
DATA_FOLDER=./data

# Change this to your local game folder
GAME_FOLDER=/res

# Postgres specific setup
Expand Down
8 changes: 4 additions & 4 deletions Uchu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine
ENV PATH $PATH:/root/.dotnet/tools

COPY Uchu .
COPY config.xml .
COPY Uchu config.default.xml .env ./

RUN apk add gettext
RUN set -o allexport && source .env && set +o allexport && envsubst < config.default.xml > config.xml
RUN dotnet build

ENTRYPOINT ["dotnet", "Uchu.Master/bin/Debug/netcoreapp3.1/Uchu.Master.dll"]
6 changes: 3 additions & 3 deletions config.xml → config.default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<Uchu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Database>
<Provider>postgres</Provider>
<Database>uchu</Database>
<Database>$POSTGRES_DB</Database>
<Host>db</Host>
<Username>uchu</Username>
<Password>uchu</Password>
<Username>$POSTGRES_USER</Username>
<Password>$POSTGRES_PASSWORD</Password>
</Database>
<ConsoleLogging>
<Level>Debug</Level>
Expand Down

0 comments on commit 871731f

Please sign in to comment.