Skip to content

Commit

Permalink
fix: don't continue on init if error
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalPazz committed Jan 1, 2025
1 parent ed14f83 commit 324c6d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ func initConfig() {

if err := viper.ReadInConfig(); err != nil {
fmt.Print(fmt.Errorf("fatal error reading config file: %w", err))
os.Exit(1)
}

if err := viper.Unmarshal(&config); err != nil {
fmt.Print(fmt.Errorf("unable to decode into config struct: %w", err))
os.Exit(1)
}

selectedProfile, exists := config.Profiles[profile]
if !exists {
fmt.Print(fmt.Errorf("profile '%s' not found in configuration", profile))
os.Exit(1)
}

if region == "" {
Expand Down

0 comments on commit 324c6d4

Please sign in to comment.