-
Notifications
You must be signed in to change notification settings - Fork 147
Rework entrypoint to deprecate some variables #72
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
Draft
Adam-Ant
wants to merge
2
commits into
master
Choose a base branch
from
entrypoint_fixup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,42 +4,66 @@ if [ -n "$DEBUG" ]; then | |
| set -x | ||
| fi | ||
|
|
||
| if ! find . -mindepth 1 | read -r; then | ||
| >&2 echo "Creating default configs..." | ||
| cp -r /opt/cfx-server-data/* /config | ||
| RCON_PASS="${RCON_PASSWORD-$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 16)}" | ||
| sed -i "s/{RCON_PASS}/${RCON_PASS}/g" /config/server.cfg; | ||
| >&2 echo "----------------------------------------------" | ||
| >&2 echo "RCON password is set to: ${RCON_PASS}" | ||
| >&2 echo "----------------------------------------------" | ||
| fi | ||
| # Empty config args defaults to loading txAdmin | ||
| CONFIG_ARGS= | ||
|
|
||
| if [ -z "$NO_ONESYNC" ]; then | ||
| ONESYNC_ARGS="+set onesync on +set onesync_population true" | ||
| fi | ||
| # Temporary during the transition - this way old configs still trigger the old (no txadmin by default) behaviour. | ||
| NO_TXADMIN = "DONTANSWERTHEPHONETOLESTERCREST" | ||
|
|
||
| CONFIG_ARGS= | ||
| if [ -z "${NO_DEFAULT_CONFIG}" ]; then | ||
| CONFIG_ARGS="$CONFIG_ARGS $ONESYNC_ARGS +exec /config/server.cfg" | ||
| # Warn if NO_TXADMIN is the default. | ||
| if [ "${NO_TXADMIN}" = "DONTANSWERTHEPHONETOLESTERCREST" ]; then | ||
| >&2 echo "------------------------------------------------------" | ||
| >&2 echo "WARNING - Default options will soon change to enabling" | ||
| >&2 echo "txAdmin by default. Set \$NO_TXADMIN to disable this." | ||
Adam-Ant marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| >&2 echo "------------------------------------------------------" | ||
| fi | ||
|
|
||
| # English is hard | ||
| if [ -z "${NO_LICENSE_KEY}${NO_LICENCE_KEY}" ]; then | ||
| if [ -z "${LICENSE_KEY}" ] && [ -n "${LICENCE_KEY}" ]; then | ||
| LICENSE_KEY="${LICENCE_KEY}" | ||
| # If NO_TXADMIN is defined, configure the server as standalone. | ||
| if [ -n "${NO_TXADMIN}" ]; then | ||
| if ! find . -mindepth 1 | read -r; then | ||
| >&2 echo "Creating default configs..." | ||
| cp -r /opt/cfx-server-data/* /config | ||
| RCON_PASS="${RCON_PASSWORD-$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 16)}" | ||
| sed -i "s/{RCON_PASS}/${RCON_PASS}/g" /config/server.cfg; | ||
| >&2 echo "----------------------------------------------" | ||
| >&2 echo "RCON password is set to: ${RCON_PASS}" | ||
| >&2 echo "----------------------------------------------" | ||
| fi | ||
|
|
||
| if [ -z "${NO_DEFAULT_CONFIG}"] && [ -z "${LICENSE_KEY}" ]; then | ||
| >&2 printf "License key not found in environment, please create one at https://keymaster.fivem.net!\n" | ||
| # If all these are true (& NO_TXADMIN above), CONFIG_ARGS will be empty, and txAdmin would start. | ||
| if [ -n "${NO_DEFAULT_CONFIG}" ] && [ -z "${$*}"]; then | ||
| >&2 printf "NO_TXADMIN specified, but no config args given. Server would load txAdmin anyway." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${CONFIG_ARGS}" ] && [ -n "${LICENSE_KEY}" ] && [ -n "${NO_DEFAULT_CONFIG}" ]; then | ||
| >&2 printf "txadmin does not use the \$LICENSE_KEY environment variable.\nPlease remove it and set it through the txadmin web UI\n\n" | ||
| exit 1 | ||
| # Set some default options. | ||
| if [ -z "${NO_DEFAULT_CONFIG}" ]; then | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If NO_TXADMIN is set explicitly by the user, we shouldn't do this |
||
| CONFIG_ARGS="$CONFIG_ARGS $ONESYNC_ARGS +exec /config/server.cfg" | ||
| fi | ||
|
|
||
| CONFIG_ARGS="$CONFIG_ARGS +set sv_licenseKey ${LICENSE_KEY}" | ||
| # I pronounce everything below this point.. Deprecated! | ||
| if [ -z "$NO_ONESYNC" ]; then | ||
| ONESYNC_ARGS="+set onesync on +set onesync_population true" | ||
| fi | ||
|
|
||
| # English is hard | ||
| if [ -z "${NO_LICENSE_KEY}${NO_LICENCE_KEY}" ]; then | ||
| if [ -z "${LICENSE_KEY}" ] && [ -n "${LICENCE_KEY}" ]; then | ||
| LICENSE_KEY="${LICENCE_KEY}" | ||
| fi | ||
|
|
||
| if [ -z "${NO_DEFAULT_CONFIG}"] && [ -z "${LICENSE_KEY}" ]; then | ||
| >&2 printf "License key not found in environment, please create one at https://keymaster.fivem.net!\n" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${CONFIG_ARGS}" ] && [ -n "${LICENSE_KEY}" ] && [ -n "${NO_DEFAULT_CONFIG}" ]; then | ||
| >&2 printf "txAdmin does not use the \$LICENSE_KEY environment variable.\nPlease remove it and set it through the txadmin web UI\n\n" | ||
| exit 1 | ||
| fi | ||
|
|
||
| CONFIG_ARGS="$CONFIG_ARGS +set sv_licenseKey ${LICENSE_KEY}" | ||
| fi | ||
| fi | ||
|
|
||
| exec /opt/cfx-server/ld-musl-x86_64.so.1 \ | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.