fix(palworld) fix some default values and add new gui options to update the ini. (#17537)

**Description**
- New GUI options
- Allow the user to define the server pass and also fix the admin pass
- fix icon

⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [X] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [X] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
the SRV_ADMIN_PWD variable seems to be left over code and does not do
anything at this time; leaving it as is.

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [X] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
Xstar97TheNoob 2024-01-27 06:40:16 -05:00 committed by GitHub
parent 294776deeb
commit 011fa36004
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 60 additions and 23 deletions

View File

@ -34,4 +34,4 @@ sources:
- https://github.com/truecharts/charts/tree/master/charts/incubator/palworld
- https://ghcr.io/ich777/steamcmd
type: application
version: 0.0.1
version: 0.0.2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

View File

@ -31,6 +31,31 @@ questions:
type: string
required: true
default: "2394010"
- variable: name
label: Server Name
description: The name of your server.
schema:
type: string
default: "TrueCharts Palworld Server"
- variable: description
label: Server Description
description: The description of your server.
schema:
type: string
default: "A Palworld Server running in Kubernetes"
- variable: max_players
label: Max Players
description: The max players that can play on your server.
schema:
type: int
default: 32
- variable: password
label: Server Password
description: Optionally set a password for the server.
schema:
type: string
private: true
default: ""
- variable: steam
label: Steam Configuration
schema:
@ -82,7 +107,7 @@ questions:
schema:
type: list
default:
- -No-useperfthreads
- -useperfthreads
- -NoAsyncLoadingThread
- -UseMultithreadForDS
required: true
@ -168,15 +193,6 @@ questions:
attrs:
# Include{persistenceBasic}
# Include{persistenceList}
# Include{ingressRoot}
- variable: main
label: "Main Ingress"
schema:
additional_attrs: true
type: dict
attrs:
# Include{ingressDefault}
# Include{ingressAdvanced}
# Include{ingressList}
# Include{securityContextRoot}
- variable: runAsUser

View File

@ -26,15 +26,19 @@ service:
palworld:
game:
id: "2394010"
name: "TrueCharts Palworld Server"
description: "A Palworld Server running in Kubernetes"
max_players: 32
password: ""
steam:
username: ""
password: ""
admin:
password: adminDocker
password: ""
params:
- EpicApp=PalServer
params_extra:
- -No-useperfthreads
- -useperfthreads
- -NoAsyncLoadingThread
- -UseMultithreadForDS
update_public_ip: false
@ -53,23 +57,40 @@ workload:
- -c
args:
- |
config=/serverdata/serverfiles/Pal/Saved/Config/LinuxServer
config={{ .Values.persistence.serverfiles.targetSelector.main.main.mountPath }}/Pal/Saved/Config/LinuxServer
cfgFile=${config}/PalWorldSettings.ini
rconPort={{ .Values.service.rcon.ports.rcon.port }}
mainPort={{ .Values.service.main.ports.main.port }}
name="{{ .Values.palworld.game.name }}"
description="{{ .Values.palworld.game.description }}"
maxPlayers={{ .Values.palworld.game.max_players }}
gamePass={{ .Values.palworld.game.password }}
adminPass={{ .Values.palworld.admin.password }}
mkdir -p ${config}
if [ ! -f ${cfgFile} ]; then
echo "Config file not found, fetching..."
# 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.service.rcon.ports.rcon.port }}/g' ${cfgFile}
echo "Set to [$(grep -Po 'RCONPort=[^,]*' ${cfgFile})]"
echo "Setting Game Port..."
sed -i 's/\(PublicPort=\)[^,]*/\1{{ .Values.service.main.ports.main.port }}/g' ${cfgFile}
echo "Set to [$(grep -Po 'PublicPort=[^,]*' ${cfgFile})]"
set_ini_value() {
local key="${1}"
local value="${2}"
echo "Setting ${key}..."
sed -i "s|\(${key}=\)[^,]*|\1${value}|g" "${cfgFile}"
echo "Set to $(grep -Po "${key}=[^,]*" "${cfgFile}")"
}
set_ini_value "RCONEnabled" "True"
set_ini_value "RCONPort" "${rconPort}"
set_ini_value "PublicPort" "${mainPort}"
set_ini_value "ServerName" "${name}"
set_ini_value "ServerDescription" "${description}"
set_ini_value "ServerPlayerMaxNum" "${maxPlayers}"
set_ini_value "ServerPassword" "${gamePass}"
set_ini_value "AdminPassword" "${adminPass}"
echo "Done!"
containers:
main: