From 3ef8c5309e5da4a6ee2ece3d87aa3767985d40d5 Mon Sep 17 00:00:00 2001 From: deveth0 Date: Tue, 5 Mar 2019 13:05:27 +0100 Subject: [PATCH] #197: Enable envsubst - README --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index b2f4889..86fc9d1 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,31 @@ Create file `config/server-adminlist.json` and add the adminlisted users. "friend" ] +## Customize configuration files + +Out-of-the box, factorio does not support environment variables inside the configuration files. A workaround is the usage of `envsubst` which generates the configuration files dynamically during startup. + +Example for server-settings.json: + + + factorio_1: + image: dtanders/factorio + ports: + - "34197:34197/udp" + volumes: + - /opt/factorio:/factorio + - ./server-settings.json:/server-settings.json + environment: + - INSTANCE_NAME=Your Instance's Name + - INSTANCE_DESC=Your Instance's Description + entrypoint: /bin/sh -c "envsubst < /server-settings.json > /factorio/config/server-settings.json && exec /docker-entrypoint.sh" + +The `server-settings.json` file may then contain the variable references like this: + + "name": "${INSTANCE_NAME}", + "description": "${INSTANCE_DESC}", + + # Container Details The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).