Skip to content

Commit

Permalink
(choria-io#1665) use choria-io/appbuilder for core appbuilder behaviors
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed May 23, 2022
1 parent bfd3757 commit 9a8e7e9
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 1,251 deletions.
17 changes: 14 additions & 3 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ import (
"syscall"
"time"

"github.com/adrg/xdg"
"github.com/choria-io/appbuilder/builder"
"github.com/choria-io/go-choria/protocol"
"github.com/choria-io/go-choria/providers/appbuilder"

"github.com/choria-io/go-choria/providers/appbuilder/discover"
"github.com/choria-io/go-choria/providers/appbuilder/kv"
"github.com/choria-io/go-choria/providers/appbuilder/rpc"
log "github.com/sirupsen/logrus"
"gopkg.in/alecthomas/kingpin.v2"

Expand Down Expand Up @@ -62,7 +65,15 @@ func ParseCLI() (err error) {
//
// TODO: too janky, need to do a better job here, looking at the name is not enough
if !strings.Contains(os.Args[0], "choria") {
builder := appbuilder.NewAppBuilder(ctx, filepath.Base(os.Args[0]))
kv.MustRegister()
rpc.MustRegister()
discover.MustRegister()

builder, err := builder.New(ctx, filepath.Base(os.Args[0]),
builder.WithConfigPaths(filepath.Join(xdg.ConfigHome, "choria", "appbuilder"), filepath.Join("etc", "choria", "appbuilder")))
if err != nil {
panic(fmt.Sprintf("app builder setup failed: %v", err))
}
if builder.HasDefinition() {
builder.RunCommand()
os.Exit(0)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ require (
github.com/brutella/dnssd v1.2.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/choria-io/appbuilder v0.0.4 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emicklei/dot v0.16.0 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d8
github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
github.com/choria-io/appbuilder v0.0.4 h1:u6RkHgSJlnNhnqoWbqXZUY//8L1XCNbREPU5uDn/DA0=
github.com/choria-io/appbuilder v0.0.4/go.mod h1:1S3nj4fALNNpkrmB7vPLCf5L9khohm8H/JD05OXrUZk=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
Expand Down
Loading

0 comments on commit 9a8e7e9

Please sign in to comment.