Skip to content

Commit

Permalink
config: nag user if API url or key are not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
phiros committed Apr 8, 2019
1 parent c2e55b9 commit 7c660d3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func main() {
c := config.NewConfig(configFileName, homeDirectory, configType)
api := mite.NewApi(c.GetApiUrl(), c.GetApiKey(), v.Version)

if c.GetApiUrl() == "" {
_, _ = fmt.Fprintln(os.Stderr, "please configure your API url by executing: 'mite config api.url=<your mite api url>'")
}

if c.GetApiKey() == "" {
_, _ = fmt.Fprintln(os.Stderr, "please configure your API key by executing: 'mite config api.key=<your mite api key>'")
}

err = cmd.HandleCommands(c, api, v)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
Expand Down

0 comments on commit 7c660d3

Please sign in to comment.