diff --git a/community/palworld/1.0.2/ci/basic-values.yaml b/community/palworld/1.0.2/ci/basic-values.yaml deleted file mode 100644 index f1c0dc6193..0000000000 --- a/community/palworld/1.0.2/ci/basic-values.yaml +++ /dev/null @@ -1,20 +0,0 @@ -palworldNetwork: - serverPort: 32211 - rconPort: 32212 - -palworldID: - user: 1000 - group: 1000 - -palworldStorage: - steamcmd: - type: pvc - server: - type: pvc - -palworldConfig: - adminPassword: sec!@#%-_ret123@#%-_!@#% - backup: - enabled: true - interval: 60 - keep: 3 diff --git a/community/palworld/1.0.2/Chart.lock b/community/palworld/1.0.3/Chart.lock similarity index 100% rename from community/palworld/1.0.2/Chart.lock rename to community/palworld/1.0.3/Chart.lock diff --git a/community/palworld/1.0.2/Chart.yaml b/community/palworld/1.0.3/Chart.yaml similarity index 98% rename from community/palworld/1.0.2/Chart.yaml rename to community/palworld/1.0.3/Chart.yaml index 2650f3eb8c..02dbbc87ad 100644 --- a/community/palworld/1.0.2/Chart.yaml +++ b/community/palworld/1.0.3/Chart.yaml @@ -3,7 +3,7 @@ description: Palworld is a multiplayer, open-world survival crafting game where annotations: title: Palworld type: application -version: 1.0.2 +version: 1.0.3 apiVersion: v2 appVersion: palworld kubeVersion: '>=1.16.0-0' diff --git a/community/palworld/1.0.2/README.md b/community/palworld/1.0.3/README.md similarity index 100% rename from community/palworld/1.0.2/README.md rename to community/palworld/1.0.3/README.md diff --git a/community/palworld/1.0.2/app-readme.md b/community/palworld/1.0.3/app-readme.md similarity index 100% rename from community/palworld/1.0.2/app-readme.md rename to community/palworld/1.0.3/app-readme.md diff --git a/community/palworld/1.0.2/charts/common-1.2.9.tgz b/community/palworld/1.0.3/charts/common-1.2.9.tgz similarity index 100% rename from community/palworld/1.0.2/charts/common-1.2.9.tgz rename to community/palworld/1.0.3/charts/common-1.2.9.tgz diff --git a/community/palworld/1.0.3/ci/basic-values.yaml b/community/palworld/1.0.3/ci/basic-values.yaml new file mode 100644 index 0000000000..9a418b5d1d --- /dev/null +++ b/community/palworld/1.0.3/ci/basic-values.yaml @@ -0,0 +1,31 @@ +palworldNetwork: + serverPort: 32211 + rconPort: 32212 + +palworldID: + user: 1000 + group: 1000 + +palworldStorage: + steamcmd: + type: pvc + server: + type: pvc + +palworldConfig: + adminPassword: asdfhjfgk7!@^&$1asdf + backup: + enabled: true + interval: 60 + keep: 3 + iniKeys: + - key: PlayerDamageRateAttack + value: 1.000000 + - key: DropItemMaxNum + value: 4000 + - key: Region + value: "" + - key: PalEggDefaultHatchingTime + value: 72.450000 + - key: bEnablePlayerToPlayerDamage + value: true diff --git a/community/palworld/1.0.2/ix_values.yaml b/community/palworld/1.0.3/ix_values.yaml similarity index 98% rename from community/palworld/1.0.2/ix_values.yaml rename to community/palworld/1.0.3/ix_values.yaml index 9c199faeee..dcd9794f72 100644 --- a/community/palworld/1.0.2/ix_values.yaml +++ b/community/palworld/1.0.3/ix_values.yaml @@ -24,6 +24,7 @@ palworldConfig: - -useperfthreads - -NoAsyncLoadingThread - -UseMultithreadForDS + iniKeys: [] updatePublicIP: false validate: false username: '' diff --git a/community/palworld/1.0.2/metadata.yaml b/community/palworld/1.0.3/metadata.yaml similarity index 100% rename from community/palworld/1.0.2/metadata.yaml rename to community/palworld/1.0.3/metadata.yaml diff --git a/community/palworld/1.0.2/questions.yaml b/community/palworld/1.0.3/questions.yaml similarity index 96% rename from community/palworld/1.0.2/questions.yaml rename to community/palworld/1.0.3/questions.yaml index 23b2931e78..749c36498b 100644 --- a/community/palworld/1.0.2/questions.yaml +++ b/community/palworld/1.0.3/questions.yaml @@ -25,9 +25,6 @@ questions: private: true required: true default: "" - valid_chars: "[a-zA-Z0-9!@#%-_]*" - valid_chars_error: | - Can contain at numbers, letters, and the following characters: !@#%-_ - variable: server label: Server Configuration description: Configure the server for Palworld @@ -56,9 +53,31 @@ questions: type: string private: true default: "" - valid_chars: "[a-zA-Z0-9!@#%-_]*" - valid_chars_error: | - Can contain at numbers, letters, and the following characters: !@#%-_ + - variable: iniKeys + label: Configure INI Keys + description: | + Enter your INI keys
+ Updates the keys in PalWorldSettings.ini + schema: + type: list + default: [] + items: + - variable: iniKey + label: INI Key + schema: + type: dict + attrs: + - variable: key + label: Key + schema: + type: string + default: "" + required: true + - variable: value + label: Value + schema: + type: string + default: "" - variable: backup label: Backup description: Configure the backup for Palworld diff --git a/community/palworld/1.0.2/templates/NOTES.txt b/community/palworld/1.0.3/templates/NOTES.txt similarity index 100% rename from community/palworld/1.0.2/templates/NOTES.txt rename to community/palworld/1.0.3/templates/NOTES.txt diff --git a/community/palworld/1.0.2/templates/_palworld.tpl b/community/palworld/1.0.3/templates/_palworld.tpl similarity index 58% rename from community/palworld/1.0.2/templates/_palworld.tpl rename to community/palworld/1.0.3/templates/_palworld.tpl index f8b286845d..2aafc444f3 100644 --- a/community/palworld/1.0.2/templates/_palworld.tpl +++ b/community/palworld/1.0.3/templates/_palworld.tpl @@ -88,32 +88,54 @@ workload: - | config={{ $srvDir }}/Pal/Saved/Config/LinuxServer cfgFile=${config}/PalWorldSettings.ini - mkdir -p ${config} + if [ ! -d ${config} ]; then + echo "Config directory not found, creating..." + mkdir -p ${config} + fi if [ ! -f ${cfgFile} ]; then echo "Config file not found, fetching..." - # Fetch the config file if it doesn't exist, just like the container does + # -- Fetch the config file if it doesn't exist, just like the container does wget -qO ${cfgFile} https://github.com/ich777/docker-steamcmd-server/raw/palworld/config/PalWorldSettings.ini fi - echo "Setting RCON status..." - sed -i 's/\(RCONEnabled=\)[^,]*/\1True/g' ${cfgFile} - echo "Set to [$(grep -Po 'RCONEnabled=[^,]*' ${cfgFile})]" - echo "Setting RCON Port..." - sed -i 's/\(RCONPort=\)[^,]*/\1{{ .Values.palworldNetwork.rconPort }}/g' ${cfgFile} - echo "Set to [$(grep -Po 'RCONPort=[^,]*' ${cfgFile})]" - echo "Setting Game Port..." - sed -i 's/\(PublicPort=\)[^,]*/\1{{ .Values.palworldNetwork.serverPort }}/g' ${cfgFile} - echo "Set to [$(grep -Po 'PublicPort=[^,]*' ${cfgFile})]" - echo "Setting Server Name..." - sed -i 's/\(ServerName=\)[^,]*/\1{{ .Values.palworldConfig.server.name | quote }}/g' ${cfgFile} - echo "Set to [$(grep -Po 'ServerName=[^,]*' ${cfgFile})]" - echo "Setting Server Description..." - sed -i 's/\(ServerDescription=\)[^,]*/\1{{ .Values.palworldConfig.server.description | quote }}/g' ${cfgFile} - echo "Set to [$(grep -Po 'ServerDescription=[^,]*' ${cfgFile})]" - echo "Setting Server Password..." - sed -i 's/\(ServerPassword=\)[^,]*/\1{{ .Values.palworldConfig.server.password | quote }}/g' ${cfgFile} - echo "Server Password set..." - echo "Setting Admin Password..." - sed -i 's/\(AdminPassword=\)[^,]*/\1{{ .Values.palworldConfig.adminPassword | quote }}/g' ${cfgFile} - echo "Admin Password set..." + + set_ini_value() { + local key="${1}" + local value="${2}" + local quote="${3:-false}" + local print="${4:-true}" + # -- Escape special characters for sed + escaped_value=$(printf '%s\n' "$value" | sed 's/[&/\]/\\&/g') + if [ "$quote" = true ]; then + escaped_value="\"${escaped_value}\"" + fi + + echo "Setting ${key}..." + sed -i "s|\(${key}=\)[^,]*|\1${escaped_value}|g" "${cfgFile}" + if [ "$print" = true ]; then + echo "Set to $(grep -Po "(?<=${key}=)[^,]*" "${cfgFile}")" + fi + } + + set_ini_value "RCONEnabled" True + set_ini_value "RCONPort" {{ .Values.palworldNetwork.rconPort }} + set_ini_value "PublicPort" {{ .Values.palworldNetwork.serverPort }} + set_ini_value "ServerName" {{ .Values.palworldConfig.server.name | quote }} true + set_ini_value "ServerDescription" {{ .Values.palworldConfig.server.description | quote }} true + set_ini_value "ServerPassword" {{ .Values.palworldConfig.server.password | squote }} true false + set_ini_value "AdminPassword" {{ .Values.palworldConfig.adminPassword | squote }} true false + + {{- range $item := .Values.palworldConfig.iniKeys }} + {{- if mustHas (kindOf $item.value) (list "int" "int64" "float64") }} + echo "Key {{ $item.key }} is a {{ kindOf $item.value }}, setting without quotes..." + set_ini_value "{{ $item.key }}" {{ $item.value }} + {{- else if or (eq ((toString $item.value) | lower) "true") (eq ((toString $item.value) | lower) "false") }} + echo "Key {{ $item.key }} is a boolean, setting without quotes..." + set_ini_value "{{ $item.key }}" {{ (toString $item.value) | camelcase }} + {{- else }} + echo "Key {{ $item.key }} is a {{ kindOf $item.value }}, setting with quotes..." + set_ini_value "{{ $item.key }}" {{ $item.value | quote }} true + {{- end }} + {{- end }} + echo "Done!" {{- end -}} diff --git a/community/palworld/1.0.2/templates/_params.tpl b/community/palworld/1.0.3/templates/_params.tpl similarity index 68% rename from community/palworld/1.0.2/templates/_params.tpl rename to community/palworld/1.0.3/templates/_params.tpl index 95de5bd598..85a4db9b63 100644 --- a/community/palworld/1.0.2/templates/_params.tpl +++ b/community/palworld/1.0.3/templates/_params.tpl @@ -15,4 +15,15 @@ {{- if not .Values.palworldConfig.backup -}} {{- $_ := set .Values.palworldConfig "backup" dict -}} {{- end -}} + + {{- $reservedKeys := list + "RCONEnabled" "RCONPort" "PublicPort" "ServerName" + "ServerDescription" "ServerPassword" "AdminPassword" + -}} + + {{- range $item := .Values.palworldConfig.iniKeys }} + {{- if (mustHas $item.key $reservedKeys) -}} + {{- fail (printf "PalWorld - [%v] is a reserved key." $item.key) -}} + {{- end -}} + {{- end -}} {{- end -}} diff --git a/community/palworld/1.0.2/templates/_persistence.tpl b/community/palworld/1.0.3/templates/_persistence.tpl similarity index 100% rename from community/palworld/1.0.2/templates/_persistence.tpl rename to community/palworld/1.0.3/templates/_persistence.tpl diff --git a/community/palworld/1.0.2/templates/_service.tpl b/community/palworld/1.0.3/templates/_service.tpl similarity index 100% rename from community/palworld/1.0.2/templates/_service.tpl rename to community/palworld/1.0.3/templates/_service.tpl diff --git a/community/palworld/1.0.2/templates/common.yaml b/community/palworld/1.0.3/templates/common.yaml similarity index 100% rename from community/palworld/1.0.2/templates/common.yaml rename to community/palworld/1.0.3/templates/common.yaml diff --git a/community/palworld/1.0.2/upgrade_strategy_disabled b/community/palworld/1.0.3/upgrade_strategy_disabled similarity index 100% rename from community/palworld/1.0.2/upgrade_strategy_disabled rename to community/palworld/1.0.3/upgrade_strategy_disabled