(WIP) Expose config file locations as env vars #422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.shnow has five variables with default valuesSERVER_SETTINGS_FILE- default$CONFIG/server-settings.jsonSERVER_ID_FILE- default$CONFIG/server-id.jsonADMINLIST_FILE- default$CONFIG/server-adminlist.jsonWHITELIST_FILE- default$CONFIG/server-whitelist.jsonBANLIST_FILE- default$CONFIG/server-banlist.jsonChanges from the original PR
FACTORIO_VOL,SAVE_NAME, ...)VAR="${VAR:-default}"server-settings.json$CONFIGas 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 ofADMIN_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.dirnameis required so the parent directory of the config file is made. I've added it back in.