Allow configuring factorio server to run with a specific save th… (#296)

This change enables specifying a specific save to use via the $SAVE_NAME
variable when $ENABLE_SERVER_LOAD_LATEST is false. Additionally, you can
set $ENABLE_GENERATE_NEW_MAP_SAVE to generate a map for $SAVE_NAME if
one does not already exist.

Co-authored-by: Chance Zibolski <czibolsk@redhat.com>
This commit is contained in:
Chance Zibolski
2019-11-24 23:31:28 -08:00
committed by Sandro
parent 6a1317cb7a
commit 7ec79a6e1b
2 changed files with 67 additions and 10 deletions

View File

@ -107,6 +107,40 @@ To load an old save stop the server and run the command `touch oldsave.zip`. Thi
To generate a new map stop the server, delete all of the saves and restart the server.
## Specify a save directly
> New in 0.17.79-2 or later
You can specify a specific save to load by configuring the server through a set of environment variables:
To load an existing save set `SAVE_NAME` to the name of your existing save file located within the `saves` directory, without the `.zip` extension:
```
sudo docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
-e ENABLE_SERVER_LOAD_LATEST=false \
-e SAVE_NAME=replaceme \
--name factorio \
--restart=always \
factoriotools/factorio
```
To generate a new map set `ENABLE_GENERATE_NEW_MAP_SAVE=true` and specify `SAVE_NAME`:
```
sudo docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
-e ENABLE_SERVER_LOAD_LATEST=false \
-e ENABLE_GENERATE_NEW_MAP_SAVE=true \
-e SAVE_NAME=replaceme \
--name factorio \
--restart=always \
factoriotools/factorio
```
## Mods