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:
parent
fd0b2a145c
commit
97439561ee
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user