package emgql import ( "github.com/spf13/pflag" "github.com/spf13/viper" "go.infratographer.com/x/viperx" ) // Config provides configuration for connecting to the Equinix Metal API provider. type Config struct { // BaseURL is the baseurl to use when connecting to the Equinix Metal API Provider. BaseURL string } // MustViperFlags registers command flags along with the viper bindings. func MustViperFlags(v *viper.Viper, flags *pflag.FlagSet) { flags.String("emgql-base-url", "", "Equinix Metal GraphQL Base URL") viperx.MustBindFlag(v, "equinixmetal.emgql.baseurl", flags.Lookup("emgql-base-url")) } // Populated checks if any field has been populated. func (c Config) Populated() bool { return c.BaseURL != "" }