Publish new changes in catalog

This commit is contained in:
sonicaj
2024-01-30 12:07:35 +00:00
parent c479033fc9
commit 65c64f02e0
17 changed files with 114 additions and 50 deletions

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -24,6 +24,7 @@ palworldConfig:
- -useperfthreads
- -NoAsyncLoadingThread
- -UseMultithreadForDS
iniKeys: []
updatePublicIP: false
validate: false
username: ''

View File

@@ -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 </br>
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

View File

@@ -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 -}}

View File

@@ -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 -}}