mirror of
https://github.com/alvierahman90/gohookr.git
synced 2024-11-22 08:09:52 +00:00
Don't print config on start, add a couple comments
This commit is contained in:
parent
5ab36c57ef
commit
87ea4cc5e5
@ -1,10 +1,6 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
// The struct that represents the config.json file
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ListenAddress string
|
ListenAddress string
|
||||||
Services map[string]struct {
|
Services map[string]struct {
|
||||||
@ -16,14 +12,12 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that all required fields are filled in
|
||||||
func (c Config) Validate() error {
|
func (c Config) Validate() error {
|
||||||
if c.ListenAddress == "" {
|
if c.ListenAddress == "" {
|
||||||
return requiredFieldError{"ListenAddress", ""}
|
return requiredFieldError{"ListenAddress", ""}
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonbytes, _ := json.MarshalIndent(c, "", " ")
|
|
||||||
fmt.Println(string(jsonbytes))
|
|
||||||
|
|
||||||
for serviceName, service := range c.Services {
|
for serviceName, service := range c.Services {
|
||||||
if service.Script.Program == "" {
|
if service.Script.Program == "" {
|
||||||
return requiredFieldError{"Script.Program", serviceName}
|
return requiredFieldError{"Script.Program", serviceName}
|
||||||
|
Loading…
Reference in New Issue
Block a user