Based on PR #367, fixes #356 - massive thanks to @SQLJames and the previous reviewers. Hopefully this PR can push the work the last inch across the line :)
⚠ Work In Progress! I'm not the best at shell scripts, and unfamiliar with Factorio config (I'm just starting out creating a mod), so please check thoroughly! I made this PR as a starting point and haven't tested everything (just that it builds).
TODO
[ ] Verify each variable is not required, and the default loads correctly
[ ] Verify each variable can be set, and overrides the default
I moved the variables to be next to the initialisation of the other variables (FACTORIO_VOL, SAVE_NAME, ...)
I used the same pattern of initialisation that the other variables use VAR="${VAR:-default}"
added a variable for server-settings.json
I used $CONFIG as a base directory for all of the variables
I removed the 'FACTORIO_prefix, made all the variables end with_FILE, and made sure each name matched the default filename (e.g.ADMINLISTinstead ofADMIN_LIST`.
I wasn't sure what the difference between mkdir -p "$BANLIST_FILE" and mkdir -p "$(dirname "$BANLIST_FILE")" - I played it safe and used the pattern that was already in the file. I figured it out - dirname is required so the parent directory of the config file is made. I've added it back in.
Based on PR #367, fixes #356 - massive thanks to @SQLJames and the previous reviewers. Hopefully this PR can push the work the last inch across the line :)
⚠ Work In Progress! I'm not the best at shell scripts, and unfamiliar with Factorio config (I'm just starting out creating a mod), so please check thoroughly! I made this PR as a starting point and haven't tested everything (just that it builds).
TODO
README.md
- What should the be set in the "Available in" column? https://github.com/factoriotools/factorio-docker/blob/8c2fc392239eeb0f05987adff4cf3f2b40d1a8af/README.md#environment-variablesSummary
docker-entrypoint.sh
now has five variables with default valuesSERVER_SETTINGS_FILE
- default$CONFIG/server-settings.json
SERVER_ID_FILE
- default$CONFIG/server-id.json
ADMINLIST_FILE
- default$CONFIG/server-adminlist.json
WHITELIST_FILE
- default$CONFIG/server-whitelist.json
BANLIST_FILE
- default$CONFIG/server-banlist.json
Changes from the original PR
FACTORIO_VOL
,SAVE_NAME
, ...)VAR="${VAR:-default}"
server-settings.json
$CONFIG
as a base directory for all of the variablesprefix, made all the variables end with
_FILE, and made sure each name matched the default filename (e.g.
ADMINLISTinstead of
ADMIN_LIST`.I wasn't sure what the difference betweenI figured it out -mkdir -p "$BANLIST_FILE"
andmkdir -p "$(dirname "$BANLIST_FILE")"
- I played it safe and used the pattern that was already in the file.dirname
is required so the parent directory of the config file is made. I've added it back in.