Check for slack_token parameter before launch
This commit is contained in:
parent
0ba1d964ec
commit
43ea994b9e
@ -21,7 +21,7 @@ Getting started
|
||||
|
||||
```javascript
|
||||
{
|
||||
"slack_token": "yourslacktokenhere"
|
||||
"slack_token": "yourslacktokenhere",
|
||||
|
||||
// add the following to use light theme, default is dark
|
||||
"theme": "light"
|
||||
|
@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
@ -28,6 +29,10 @@ func NewConfig(filepath string) (*Config, error) {
|
||||
return &cfg, err
|
||||
}
|
||||
|
||||
if cfg.SlackToken == "" {
|
||||
return &cfg, errors.New("couldn't find 'slack_token' parameter")
|
||||
}
|
||||
|
||||
if cfg.Theme == "light" {
|
||||
termui.ColorMap = map[string]termui.Attribute{
|
||||
"fg": termui.ColorBlack,
|
||||
|
@ -29,7 +29,7 @@ func CreateAppContext(flgConfig string) *AppContext {
|
||||
// Load config
|
||||
config, err := config.NewConfig(flgConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: not able to load config file: %s", flgConfig)
|
||||
log.Fatalf("ERROR: not able to load config file (%s): %s", flgConfig, err)
|
||||
}
|
||||
|
||||
// Create Service
|
||||
|
Loading…
Reference in New Issue
Block a user