Add method to validate configuration
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package lumecmd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"strconv"
|
||||
@ -92,3 +93,12 @@ func GetCommand(name string) (Command, bool) {
|
||||
cmd, ok := commandRegistry[name]
|
||||
return cmd, ok
|
||||
}
|
||||
|
||||
// Validate configuration struct
|
||||
func (c *Config) Validate() error {
|
||||
var err error
|
||||
if c.AccessToken == "" {
|
||||
err = errors.New("access_token is not set")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user