Skip to content

Commit

Permalink
fix: require user to run eibc init before start (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs authored Sep 22, 2024
1 parent a31f605 commit 61a002f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
7 changes: 7 additions & 0 deletions cmd/eibc/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ func Cmd() *cobra.Command {
return
}

err = eibcutils.CreateMongoDbContainer()
if err != nil {
pterm.Error.Println("failed to create mongodb container:", err)
return
}
pterm.Info.Println("created eibc mongodb container")

pterm.Info.Println("eibc config updated successfully")
pterm.Info.Printf(
"eibc client initialized successfully at %s\n",
Expand Down
27 changes: 6 additions & 21 deletions cmd/eibc/start/start.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package start

import (
"fmt"
"log"
"os"
"path/filepath"

Expand Down Expand Up @@ -30,27 +28,14 @@ func Cmd() *cobra.Command {
}

if !ok {
fmt.Println("eibc home directory not present, running init")
c := eibcutils.GetInitCmd()

_, err := bash.ExecCommandWithStdout(c)
if err != nil {
return
}

err = eibcutils.EnsureWhaleAccount()
if err != nil {
log.Printf("failed to create whale account: %v\n", err)
return
}
}

err = eibcutils.CreateMongoDbContainer()
if err != nil {
pterm.Error.Println("failed to create mongodb container:", err)
pterm.Error.Println("eibc client not initialized")
pterm.Info.Printf(
"run %s to initialize the eibc client\n",
pterm.DefaultBasicText.WithStyle(pterm.FgYellow.ToStyle()).
Sprintf("roller eibc init"),
)
return
}
pterm.Info.Println("created eibc mongodb container")

c := eibcutils.GetStartCmd()
err = bash.ExecCmdFollow(c)
Expand Down

0 comments on commit 61a002f

Please sign in to comment.