Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

aSemy
Copy link

@aSemy aSemy commented Oct 25, 2021

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

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

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
2 participants