Skip to content

Commit

Permalink
fix(datastore): startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-pad committed Apr 24, 2024
1 parent eb42693 commit f82b959
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/datastore/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func buildDatastoreStartCmd(app *burrito.App) *cobra.Command {
// Do not display usage on program error
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
return app.StartRunner()
return app.StartDatastore()
},
}
cmd.Flags().StringVar(&app.Config.Server.Addr, "addr", ":8080", "addr the datastore listens on")
Expand Down
7 changes: 7 additions & 0 deletions internal/burrito/burrito.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/padok-team/burrito/internal/burrito/config"
"github.com/padok-team/burrito/internal/controllers"
"github.com/padok-team/burrito/internal/datastore"
"github.com/padok-team/burrito/internal/runner"
"github.com/padok-team/burrito/internal/server"
)
Expand All @@ -16,6 +17,7 @@ type App struct {
Runner Runner
Controllers Controllers
Server Server
Datastore Datastore

Out io.Writer
Err io.Writer
Expand All @@ -33,13 +35,18 @@ type Controllers interface {
Exec()
}

type Datastore interface {
Exec()
}

func New() (*App, error) {
c := &config.Config{}
app := &App{
Config: c,
Runner: runner.New(c),
Controllers: controllers.New(c),
Server: server.New(c),
Datastore: datastore.New(c),
Out: os.Stdout,
Err: os.Stderr,
}
Expand Down
6 changes: 6 additions & 0 deletions internal/burrito/datastore.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package burrito

func (app *App) StartDatastore() error {
app.Controllers.Exec()
return nil
}

0 comments on commit f82b959

Please sign in to comment.