Skip to content

Commit

Permalink
(choria-io#2169) Pass choria federations to external discovery agent
Browse files Browse the repository at this point in the history
  • Loading branch information
vjanelle committed May 16, 2024
1 parent 69c8740 commit 10c6902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
ran bool
shutdownGrace = 10 * time.Second

federations = []string{}
federations = ""
)

func ParseCLI() (err error) {
Expand Down Expand Up @@ -198,7 +198,9 @@ func commonConfigure() error {

// If list of federations is specified on the CLI, mutate the configuration directly
if len(federations) > 0 {
cfg.Choria.FederationCollectives = federations
cfg.Choria.FederationCollectives = strings.Split(federations, ",")
} else {
fmt.Println("We are not setting federations")
}

applyBuildAndEnvironmentSettings()
Expand Down
7 changes: 4 additions & 3 deletions cmd/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ type discoverCommand struct {
verbose bool
silent bool
fo *discovery.StandardOptions

federations []string
}

func (d *discoverCommand) Setup() error {
Expand All @@ -37,7 +35,9 @@ func (d *discoverCommand) Setup() error {
d.fo.AddSelectionFlags(d.cmd)
d.fo.AddFlatFileFlags(d.cmd)

d.cmd.Flag("federations", "List of federations to search for collectives in").StringsVar(&federations)
d.cmd.Flag("federations", "List of federations to search for collectives in, comma seperated").StringVar(&federations)

Check failure on line 38 in cmd/discover.go

View workflow job for this annotation

GitHub Actions / test (1.22)

"seperated" is a misspelling of "separated"

fmt.Println("asdf")

d.cmd.Flag("verbose", "Log verbosely").Default("false").Short('v').UnNegatableBoolVar(&d.verbose)
d.cmd.Flag("json", "Produce JSON output").Short('j').UnNegatableBoolVar(&d.jsonFormat)
Expand All @@ -48,6 +48,7 @@ func (d *discoverCommand) Setup() error {

func (d *discoverCommand) Configure() error {
err = commonConfigure()

if err != nil {
return err
}
Expand Down

0 comments on commit 10c6902

Please sign in to comment.