Fix issues with config handling
This commit is contained in:
10
config.go
10
config.go
@@ -12,15 +12,15 @@ import (
|
||||
const fmConfig = "config.yml"
|
||||
|
||||
type GoConfig struct {
|
||||
Server struct {
|
||||
Server struct { // server specific settings
|
||||
ServDir string `yaml:"serverFolder"`
|
||||
WorldFile string `yaml:"worldFile"`
|
||||
ServCfg string `yaml:"serverSettings"`
|
||||
ServExec string `yaml:"serverExec"`
|
||||
ServPort int `yaml:"port"`
|
||||
} `yaml:"server"`
|
||||
|
||||
Factoryman struct {
|
||||
ServPort int `yaml:"port"`
|
||||
Factoryman struct { // factoryman settings
|
||||
BackupDir string `yaml:"backupDir"`
|
||||
UseScreen bool `yaml:"screen"`
|
||||
ScreenName string `yaml:"screenName"`
|
||||
@@ -41,7 +41,7 @@ func readCfg(factCfg string) GoConfig {
|
||||
}
|
||||
return config
|
||||
}
|
||||
func isItReal(path string) bool {
|
||||
func isItReal(path string) bool { //check if path exists
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return true
|
||||
} else if errors.Is(err, os.ErrNotExist) {
|
||||
@@ -50,7 +50,7 @@ func isItReal(path string) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
func verifyConfig(config GoConfig) bool {
|
||||
func verifyConfig(config GoConfig) bool { // check each file/dir to see if it exists
|
||||
if !isItReal(config.Server.ServDir) {
|
||||
fmt.Printf("PATH NOT FOUND: %s", config.Server.ServDir)
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user