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

Creation of Server Settings Based On Environment Variables #304

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c4c1ebb
insert example files to use for starting the template
Dec 25, 2019
80eb02f
Added UpdateTemplate Function
Dec 25, 2019
c0498cb
ServerSettings in bash done.
Dec 25, 2019
7c3971e
update quotes to prevent globing, and allow for expansion
Dec 25, 2019
01425f3
replace values with template keys
Dec 26, 2019
6995163
Change template keys with substrings
Dec 26, 2019
8393065
add newline to end of server settings template
Dec 27, 2019
bd44ae6
Complete Shell Map Gen Settings
Dec 27, 2019
bddbd4a
add quotes to quoted areas.
Dec 27, 2019
b39b141
replace map gen template values with sed keys
Dec 27, 2019
319683b
add extra space
Dec 27, 2019
c5cb7b1
Completed script for map settings
Dec 27, 2019
26bc037
update template
Dec 27, 2019
37c03e5
add newline at end of template
Dec 27, 2019
65b34a6
remove shebang space.
Dec 27, 2019
bd18cba
move settigns file generation from docker-entrypoint.sh and create-se…
Dec 27, 2019
e9dc37b
Add environment Variable to enable settings file generation
Dec 27, 2019
2dedaab
add table of options to the readme, and several options to controll p…
Dec 27, 2019
b59f73b
add backing up old settings files
Dec 27, 2019
fa4adb5
Merge branch 'master' into env_vars
Jan 24, 2020
c7e3a8e
add env_vars files to 0.18 folder
Jan 24, 2020
8ec7688
update to prevent globbing and word splitting
Jan 24, 2020
fdc5758
remove unnecessary quotes
Jan 24, 2020
3adce84
make create-settings executable
Jan 28, 2020
4cf70cd
Fix Unset Variable Error
Jan 28, 2020
8896984
Merge branch 'master' of github.com:factoriotools/factorio-docker int…
Feb 29, 2020
6a2eee0
Fix to allow for new 0.18 settings, and to properly check for setting…
Feb 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 0.18/files/create-settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ if [[ ${FORCE_GENERATE_SETTINGS_FILES:-} ]]
then

#backup old files using timestamp.
if [[ ! -f $CONFIG/server-settings.json ]]
if [[ -f $CONFIG/server-settings.json ]]
then
mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json.$(date +%Y.%m.%d.%H.%M.%S)"
fi

if [[ ! -f $CONFIG/map-gen-settings.json ]]
if [[ -f $CONFIG/map-gen-settings.json ]]
then
mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json.$(date +%Y.%m.%d.%H.%M.%S)"
fi

if [[ ! -f $CONFIG/map-settings.json ]]
if [[ -f $CONFIG/map-settings.json ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those changes are a mistake.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basing off of https://linuxize.com/post/bash-check-if-file-exists/ and that i was getting errors when I had it the other way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why it should error but right now it checks if the file does exist and then copies the default file but we want to do it when the file does not exist.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the section that backs up an existing settings file (if you force the update of the settings via FORCE_GENERATE_SETTINGS_FILES). As such, if the file exists, we want to back it up. Lines 278-295 are the ones that you might be confusing these with. those are the ones that only move the generated settings file in if a file does not already exist.

then
mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json.$(date +%Y.%m.%d.%H.%M.%S)"
fi
Expand Down
4 changes: 3 additions & 1 deletion 0.18/files/map-settings-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
"short_request_max_steps": 1000,
"short_request_ratio": 0.5,
"min_steps_to_check_path_find_termination": 2000,
"start_to_goal_cost_multiplier_to_terminate_path_find": 500.0
"start_to_goal_cost_multiplier_to_terminate_path_find": 500.0,
"overload_levels": [0, 100, 500],
"overload_multipliers": [2, 3, 4]
},
"max_failed_behavior_count": 3
}