Made the service into a daemon that you can route IPC commands to

This commit is contained in:
2026-06-05 17:12:24 -05:00
parent 073db62fb1
commit 70483037c9
5 changed files with 280 additions and 65 deletions

View File

@@ -10,6 +10,7 @@ import (
)
type VsServerConfigOptions struct {
Version string `json:"Version"`
ServerName string `json:"ServerName"`
Port int `json:"Port"`
IpAddress string `json:"IpAddress"`
@@ -20,29 +21,6 @@ type VsServerConfigOptions struct {
PreApprovedRole string `json:"PreApprovedRole"`
}
// func WriteInstanceConfig(instanceDir string, settings VsServerConfig) error {
// configPath := filepath.Join(instanceDir, "serverconfig.json")
// if settings.IpAddress == "" {
// settings.IpAddress = "0.0.0.0"
// }
// if settings.MaxClients == 0 {
// settings.MaxClients = 16
// }
// data, err := json.MarshalIndent(settings, "", " ")
// if err != nil {
// return fmt.Errorf("failed to marshal server configuration: %w", err)
// }
// err = os.WriteFile(configPath, data, 0644)
// if err != nil {
// return fmt.Errorf("failed writing serverconfig.json to instance: %w", err)
// }
// return nil
// }
func PrepareInstanceConfig(templateVersion string, instanceConfigPath string, config VsServerConfigOptions, cfg *AppConfig) error {
templatePath := filepath.Join(cfg.Storage.ConfigTemplatesDir, templateVersion, "serverconfig.json")