Skip to content

(WIP) Expose config file locations as env vars - #422

Merged
fank merged 9 commits into
factoriotools:masterfrom
aSemy:master
Nov 2, 2026
Merged

fank merged 9 commits into
factoriotools:masterfrom
aSemy:master

Conversation

@aSemy

@aSemy aSemy commented Oct 25, 2021 •

Copy link
Copy Markdown

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

Summary

docker-entrypoint.sh now has five variables with default values

  • SERVER_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

  • 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.

@SQLJames

Copy link
Copy Markdown

@aSemy I was able to solve this with an init container on the helm chart. Please see SQLJames/factorio-server-charts#13

@fank

fank commented Nov 2, 2026

Copy link
Copy Markdown
Member

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.

@fank

fank commented Nov 2, 2026

Copy link
Copy Markdown
Member

Final validation update: regression, ShellCheck and Hadolint are all green on 2482b64. The PR is mergeable against current master and remains unmerged. The previously reported local tests and combined-tree check with #620 also passed.

Composed by the coding-assistant agent, posted under my account.

@fank
fank merged commit 025d030 into factoriotools:master Nov 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose config file locations as env vars

3 participants