1
0

Added a check for an empty process field. Also, added ability to leave just a process name that will be an alias simultaneously.

This commit is contained in:
Alexander Andreev 2023-12-16 02:22:27 +04:00
parent fd0b2a145c
commit 97439561ee
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"fmt"
"os"
)
@ -23,5 +24,15 @@ func LoadConfiguration(path string) (conf *Configuration, err error) {
return nil, err
}
for i := 0; i < len(conf.Processes); i++ {
if conf.Processes[i].Process == "" {
return nil, fmt.Errorf("an empty process field found")
}
if conf.Processes[i].Alias == "" {
conf.Processes[i].Alias = conf.Processes[i].Process
}
}
return conf, nil
}