Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Execute() int {

profile, err := cfg.ActiveProfile()
if err != nil {
cmdutils.CheckError(err, cfg.TerminalNoColor)
terminal.Warning("%s\n", err.Error())
}

logger.Info("connection timeout is %v second(s)", profile.Timeout)
Expand Down
2 changes: 1 addition & 1 deletion internal/handlers/localaaa.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (h LocalAAAHandler) Commands() []*cobra.Command {

p, err := h.Runtime.Config.ActiveProfile()
if err != nil {
logger.Fatal(err, "failed to load active profile")
logger.Warn("failed to load active profile, using defaults")
}

if p.MongoUrl != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/localaaa.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type LocalAAARunner struct {
func NewLocalAAARunner(client client.Client, cfg *config.Config) LocalAAARunner {
activeProfile, err := cfg.ActiveProfile()
if err != nil {
logger.Fatal(err, "")
logger.Warn("failed to load active profile, using defaults")
}

mongoUrl := activeProfile.MongoUrl
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/localclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (r *LocalClientRunner) ShowConfig(in Request) (*Response, error) {

profile, err := r.config.ActiveProfile()
if err != nil {
return nil, err
logger.Warn("failed to load active profile, using defaults")
}

var port int
Expand Down
2 changes: 1 addition & 1 deletion internal/terminal/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Error(err error, terminalNoColor bool) {
}

func Warning(format string, args ...interface{}) {
Display(fmt.Sprintf("WARNING: %s", format), args)
Display(fmt.Sprintf("WARNING: %s", format), args...)
}

// DisplayTabWriter takes in a string for a table that already has tab and newlines set
Expand Down
8 changes: 6 additions & 2 deletions pkg/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package config

import (
"errors"
"fmt"
"os"
"reflect"
Expand Down Expand Up @@ -183,7 +182,12 @@ func (ac *Config) GetProfile(name string) (*Profile, error) {
if cfg, exists := ac.profiles[name]; exists {
return cfg, nil
}
return nil, errors.New(fmt.Sprintf("profile `%s` does not exist", name))
p := loadProfile(
map[string]interface{}{},
map[string]interface{}{},
map[string]interface{}{},
)
return p, fmt.Errorf("profile `%s` not found, using defaults", name)
}

func (ac *Config) ActiveProfile() (*Profile, error) {
Expand Down