Skip to content

Commit

Permalink
fix: use fatal log instead of returning an error
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed Jun 30, 2022
1 parent 5e6af67 commit e9596b0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cmd/wishbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ var rootCmd = &coral.Command{
Use: "wishbox",
Version: version.Version,
Short: "wishlist using netbox as inventory source",
RunE: root,
Run: root,
}

func root(cmd *coral.Command, args []string) error {
func root(cmd *coral.Command, args []string) {
k, err := keygen.New(".wishlist/server", nil, keygen.Ed25519)
if err != nil {
return err
log.Fatalf("failed to generate host keys: %v", err)
}
if !k.KeyPairExists() {
if err := k.WriteKeys(); err != nil {
return err
log.Fatalf("failed to write host keys: %v", err)
}
}

cfg, err := config.Get()
if err != nil {
return err
log.Fatalf("failed to get config: %v", err)
}

endpoints, err := netbox.GetInventory(cfg.Netbox)
if err != nil {
return err
log.Fatalf("failed to get initial inventory: %v", err)
}

// wishlist config
Expand Down Expand Up @@ -89,7 +89,6 @@ func root(cmd *coral.Command, args []string) error {
if err := wishlist.Serve(wcfg); err != nil {
log.Fatalln(err)
}
return nil
}

func main() {
Expand Down

0 comments on commit e9596b0

Please sign in to comment.