Add ability to pass commands not in config yaml

This commit is contained in:
Andrew Alexander
2020-08-12 11:38:22 -04:00
committed by Chris Marshall
parent e1ee91b4f7
commit 527087d394
5 changed files with 35 additions and 0 deletions

View File

@ -64,6 +64,7 @@ type Config struct {
GameConfig `json:"game"`
FileServerConfig `json:"fs"`
ServerConfig `json:"server"`
Commands []string `json:"commands"`
Maps
}
@ -126,6 +127,9 @@ func writeStruct(v reflect.Value) ([]byte, error) {
case Maps:
data, _ := val.Marshal()
b.Write(data)
case []string:
data := strings.Join(val, "\n")
b.WriteString(fmt.Sprintf("%s\n", data))
default:
panic(fmt.Errorf("received unknown type %T", val))
}
@ -180,6 +184,7 @@ func Default() *Config {
return &Config{
FragLimit: 25,
TimeLimit: metav1.Duration{Duration: 15 * time.Minute},
Commands: []string{},
GameConfig: GameConfig{
Log: "",
MOTD: "Welcome to Critical Stack",

View File

@ -22,6 +22,9 @@ server:
hostname: "quakekube"
maxClients: 12
password: "changeme"
commands:
- seta g_inactivity 600
- seta sv_timeout 120
maps:
- name: q3dm7
type: FreeForAll
@ -56,6 +59,8 @@ seta sv_allowDownload "0"
seta sv_hostname "quakekube"
seta sv_maxclients "12"
seta rconpassword "changeme"
seta g_inactivity 600
seta sv_timeout 120
set d0 "seta g_gametype 0 ; map q3dm7 ; set nextmap vstr d1"
set d1 "seta g_gametype 0 ; map q3dm17 ; set nextmap vstr d2"
set d2 "seta g_gametype 4 ; capturelimit 8 ; map q3wctf1 ; set nextmap vstr d3"