config
Server
modkit.config reads values from server.cfg. The server plugin reads the file once when it starts. Use it for settings that do not belong into a script, such as a webhook URL.
Three kinds of lines are readable.
set discord_webhook https://discord.com/api/webhooks/...
sets Discord "discord.gg/yourserver"
sv_maxplayers 40
set <name> <value>is only for scripts. The runner ignores the line.sets <name> "<text>"also shows up in the launcher's server list, see server.cfg. Do not put secrets there.- Every
sv_key is readable, exceptsv_rconpassword,sv_eosclientidandsv_eosclientsecret.
Quotes around a value are removed. Names are case sensitive. When a name appears twice, the last line wins.
modkit.config.get
modkit.config.get(name [, default])
Returns: the value as a string, or default when the name is not in server.cfg.
local webhook = modkit.config.get("discord_webhook")
if not webhook then modkit.log.warn("no discord_webhook in server.cfg") end
modkit.config.getNumber
modkit.config.getNumber(name [, default])
Returns: the value as a number, or default when the name is missing or the value is not a number.
local slots = modkit.config.getNumber("sv_maxplayers", 20)