Skip to content

Commit

Permalink
Fix flag defaults not registered in guacrest binary (#2356)
Browse files Browse the repository at this point in the history
Signed-off-by: robert-cronin <[email protected]>
  • Loading branch information
robert-cronin authored Dec 10, 2024
1 parent ea697da commit ee8c003
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/guacrest/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import (
"github.com/guacsec/guac/pkg/version"
"github.com/spf13/cobra"
"github.com/spf13/viper"

// to register the ent backend flag defaults, i.e. --db-driver and --db-address
"github.com/guacsec/guac/pkg/assembler/backends"
_ "github.com/guacsec/guac/pkg/assembler/backends/ent/backend"
)

var flags = struct {
Expand Down Expand Up @@ -81,8 +85,6 @@ func init() {

// configuration of direct database connection
"db-direct-connection",
"db-driver",
"db-address",
})
if err != nil {
fmt.Fprintf(os.Stderr, "failed to setup flags: %v", err)
Expand All @@ -95,6 +97,12 @@ func init() {
os.Exit(1)
}

// Register backend-specific flags
if err := backends.RegisterFlags(rootCmd); err != nil {
fmt.Fprintf(os.Stderr, "failed to register backend flags: %v", err)
os.Exit(1)
}

viper.SetEnvPrefix("GUAC")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()
Expand Down

0 comments on commit ee8c003

Please sign in to comment.