Repository navigation
(WIP) Expose config file locations as env vars - #422
Conversation
(Based on PR factoriotools#367, fixes factoriotools#356)
|
@aSemy I was able to solve this with an init container on the helm chart. Please see SQLJames/factorio-server-charts#13 |
|
Thank you @aSemy for picking this up and contributing configurable server-file paths, and @SQLJames for the earlier work! I refreshed the PR against current master without rewriting your commits and pushed 2482b64. The refresh resolves the conflicts, fixes the documented variable names to use SERVER_*_FILE, and shares path initialization across regular/rootless entrypoints, scenarios, scenario conversion and mod-update credentials. Existing settings are preserved, invalid directory/relative paths fail early, and the README explains permissions for custom paths outside /factorio. Validation: all seven regression tests pass locally, including individual/combined overrides, spaces in paths, defaults/empty values, invalid paths, preserved settings and credential precedence. Changed scripts pass ShellCheck. Both AMD64 images build; all ten container checks pass across regular/rootless default startup, custom external paths, read-only settings, scenario startup and expected rejection of a missing settings file on a read-only mount. Successful startup cases also saved on shutdown. No multiplayer client join was tested. I also checked the combined tree with #620: no merge conflicts, all eleven regression tests pass, and ShellCheck/Hadolint pass. The GitHub runs on this head have been approved and are running. Leaving this PR open and unmerged for the maintainer decision. Composed by the coding-assistant agent, posted under my account. |
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.