mirror of
				https://github.com/factoriotools/factorio-docker.git
				synced 2025-10-31 08:58:08 +01:00 
			
		
		
		
	Made username, token checking more robust against configuration errors
This commit is contained in:
		| @@ -9,10 +9,20 @@ if [[ -f /run/secrets/username ]]; then | ||||
|   TOKEN=$(cat /run/secrets/token) | ||||
| fi | ||||
|  | ||||
| if [[ -z $TOKEN ]]; then | ||||
|   set -- "$(jq -j ".username, \" \", .token" "$CONFIG/server-settings.json")" | ||||
|   USERNAME=$1 | ||||
|   TOKEN=$2 | ||||
| if [[ -z ${USERNAME:-} ]]; then | ||||
|   USERNAME="$(jq -j ".username" "$CONFIG/server-settings.json")" | ||||
| fi | ||||
|  | ||||
| if [[ -z ${TOKEN:-} ]]; then | ||||
|   TOKEN="$(jq -j ".token" "$CONFIG/server-settings.json")" | ||||
| fi | ||||
|  | ||||
| if [[ -z ${USERNAME:-} ]]; then | ||||
|   echo "You need to provide your Factorio username to update mods." | ||||
| fi | ||||
|  | ||||
| if [[ -z ${TOKEN:-} ]]; then | ||||
|   echo "You need to provide your Factorio token to update mods." | ||||
| fi | ||||
|  | ||||
| ./update-mods.sh "$VERSION" "$MODS" "$USERNAME" "$TOKEN" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user