Merge pull request #26 from ghaabor/slack-token-name-check
Check for slack_token parameter before launch
This commit is contained in:
commit
14d2fc5a7f
@ -21,7 +21,7 @@ Getting started
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"slack_token": "yourslacktokenhere"
|
"slack_token": "yourslacktokenhere",
|
||||||
|
|
||||||
// add the following to use light theme, default is dark
|
// add the following to use light theme, default is dark
|
||||||
"theme": "light"
|
"theme": "light"
|
||||||
|
@ -2,6 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/gizak/termui"
|
"github.com/gizak/termui"
|
||||||
@ -28,6 +29,10 @@ func NewConfig(filepath string) (*Config, error) {
|
|||||||
return &cfg, err
|
return &cfg, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.SlackToken == "" {
|
||||||
|
return &cfg, errors.New("couldn't find 'slack_token' parameter")
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.Theme == "light" {
|
if cfg.Theme == "light" {
|
||||||
termui.ColorMap = map[string]termui.Attribute{
|
termui.ColorMap = map[string]termui.Attribute{
|
||||||
"fg": termui.ColorBlack,
|
"fg": termui.ColorBlack,
|
||||||
|
@ -29,7 +29,7 @@ func CreateAppContext(flgConfig string) *AppContext {
|
|||||||
// Load config
|
// Load config
|
||||||
config, err := config.NewConfig(flgConfig)
|
config, err := config.NewConfig(flgConfig)
|
||||||
if err != nil {
|
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
|
// Create Service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user