diff --git a/cmd/baton-vgs/config.go b/cmd/baton-vgs/config.go index bdc0b65..70002ee 100644 --- a/cmd/baton-vgs/config.go +++ b/cmd/baton-vgs/config.go @@ -2,16 +2,30 @@ package main import ( "context" + "errors" "github.com/conductorone/baton-sdk/pkg/cli" + "github.com/spf13/cobra" ) // config defines the external configuration required for the connector to run. type config struct { cli.BaseConfig `mapstructure:",squash"` // Puts the base config options in the same place as the connector options + Vault string + ClientId string + ClientSecret string } // validateConfig is run after the configuration is loaded, and should return an error if it isn't valid. func validateConfig(ctx context.Context, cfg *config) error { + if cfg.Vault == "" { + return errors.New("vault is required") + } + return nil } + +// cmdFlags sets the cmdFlags required for the connector. +func cmdFlags(cmd *cobra.Command) { + cmd.PersistentFlags().String("vault", "", "The VGS vault. ($BATON_VAULT)") +} diff --git a/cmd/baton-vgs/main.go b/cmd/baton-vgs/main.go index 2c3abe8..a329a17 100644 --- a/cmd/baton-vgs/main.go +++ b/cmd/baton-vgs/main.go @@ -27,6 +27,7 @@ func main() { } cmd.Version = version + cmdFlags(cmd) err = cmd.Execute() if err != nil { diff --git a/docker-compose.yaml b/docker-compose.yaml index ed0b81c..01fb52e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,9 +4,9 @@ services: image: quay.io/verygoodsecurity/vgs-cli:${VERSION:-latest} stdin_open: true tty: true - environment: - VGS_CLIENT_ID: "" - VGS_CLIENT_SECRET: "" + # environment: + # VGS_CLIENT_ID: "" + # VGS_CLIENT_SECRET: "" entrypoint: bash env_file: - .env