Changed GoConfig to UsrConfig

Changed GoConfig struct to UsrConfig
This commit is contained in:
2026-05-04 11:50:08 -06:00
parent 6ef8f280a8
commit e051d2d6f6
6 changed files with 7 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ import (
"time"
)
func backUp(cmd string, c GoConfig) {
func backUp(cmd string, c UsrConfig) {
switch cmd {
case "full":
fmt.Println("Starting full server backup")

4
cli.go
View File

@@ -19,9 +19,7 @@ func cliToolMode() {
startStopServer("stop", c)
}
case "help", "h", "--help", "-h":
fmt.Printf("Start Server: %s start\nStop Server: %s stop\n", os.Args[0], os.Args[0])
fmt.Printf("Run backup\n\tFull backup: %s backup full", os.Args[0])
fmt.Printf("\n\tBackup saves: %s backup saves\n", os.Args[0])
fmt.Printf("Start Server: %s start\nStop Server: %s stop\nRun backup\n\tFull backup: %s backup full\n\tBackup saves: %s backup saves\n", os.Args[0], os.Args[0], os.Args[0], os.Args[0])
case "download":
if len(os.Args) > 2 {
switch os.Args[2] {

View File

@@ -9,14 +9,14 @@ import (
"gopkg.in/yaml.v3"
)
func readCfg(factCfg string) GoConfig {
func readCfg(factCfg string) UsrConfig {
//read config file (YAML)
fileBytes, err := os.ReadFile(factCfg)
if err != nil {
log.Fatalf("Error reading config file: %v", err)
}
// return Struct
var config GoConfig
var config UsrConfig
err = yaml.Unmarshal(fileBytes, &config)
if err != nil {
log.Fatalf("Error unmarshalling YAML file: %v", err)
@@ -32,7 +32,7 @@ func isItReal(path string) bool { //check if path exists
return false
}
}
func verifyConfig(config GoConfig) bool { // check each file/dir to see if it exists
func verifyConfig(config UsrConfig) bool { // check each file/dir to see if it exists
if !isItReal(config.Server.ServDir) { //check for Server directory
fmt.Printf("PATH NOT FOUND: %s", config.Server.ServDir)
return false

Binary file not shown.

View File

@@ -7,7 +7,7 @@ import (
"os/exec"
)
func startStopServer(cmd string, con GoConfig) {
func startStopServer(cmd string, con UsrConfig) {
switch cmd {
case "start":
x := fmt.Sprintf("%s --port %d --server-settings %s --start-server %s", con.Server.ServExec, con.Server.ServPort, con.Server.ServCfg, con.Server.WorldFile)

View File

@@ -1,7 +1,7 @@
package main
// config struct
type GoConfig struct {
type UsrConfig struct {
Server struct { // server specific settings
ServDir string `yaml:"serverFolder"`
WorldFile string `yaml:"worldFile"`