Documentation
¶
Index ¶
- Variables
- type BluelinkSignatureV1Config
- type BluelinkSignatureV1KeyPair
- type EngineAuthConfig
- type OAuth2Config
- type Provider
- func (p *Provider) BindEnvVar(configName string, envVarName string)
- func (p *Provider) BindPFlag(configName string, flag *pflag.Flag)
- func (p *Provider) GetBool(configName string) (bool, bool)
- func (p *Provider) GetFloat32(configName string) (float32, bool)
- func (p *Provider) GetFloat64(configName string) (float64, bool)
- func (p *Provider) GetInt32(configName string) (int32, bool)
- func (p *Provider) GetInt64(configName string) (int64, bool)
- func (p *Provider) GetString(configName string) (string, bool)
- func (p *Provider) GetUint32(configName string) (uint32, bool)
- func (p *Provider) GetUint64(configName string) (uint64, bool)
- func (p *Provider) LoadConfigFile(configFilePath string) error
- func (p *Provider) SetDefault(configName, value string)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedConfigFileFormat is returned when the config file format // is not supported by the provider. ErrUnsupportedConfigFileFormat = errors.New("unsupported config file format, only yaml, json and toml are supported") )
Functions ¶
This section is empty.
Types ¶
type BluelinkSignatureV1Config ¶
type BluelinkSignatureV1Config struct {
KeyPair BluelinkSignatureV1KeyPair `json:"keyPair"`
CustomHeaders []string `json:"customHeaders"`
}
BluelinkSignatureV1Config is the configuration for the Bluelink Signature v1 authentication.
type BluelinkSignatureV1KeyPair ¶
type BluelinkSignatureV1KeyPair struct {
KeyID string `json:"keyId"`
SecretKey string `json:"secretKey"`
}
BluelinkSignatureV1KeyPair is the key pair for the Bluelink Signature v1 authentication.
type EngineAuthConfig ¶
type EngineAuthConfig struct {
Method string `json:"method"`
APIKey string `json:"apiKey"`
OAuth2 *OAuth2Config `json:"oauth2"`
BluelinkSignatureV1 *BluelinkSignatureV1Config `json:"bluelinkSignatureV1"`
}
EngineAuthConfig is the configuration for the deploy engine authentication.
func LoadEngineAuthConfig ¶
func LoadEngineAuthConfig(confProvider *Provider) (*EngineAuthConfig, error)
LoadEngineAuthConfig loads the engine authentication configuration from an auth config file.
type OAuth2Config ¶
type OAuth2Config struct {
// ClientID is used as a part of the client credentials grant type
// to obtain an access token from the OAuth2 or OIDC provider.
ClientID string `json:"clientId"`
// ClientSecret is used as a part of the client credentials grant type
// to obtain an access token from the OAuth2 or OIDC provider.
ClientSecret string `json:"clientSecret"`
// ProviderBaseURL is the base URL of the OAuth2 or OIDC provider.
// This is the URL from which the client will use to obtain
// the discovery document for the provider at either `/.well-known/openid-configuration`
// or `/.well-known/oauth-authorization-server`.
// When TokenEndpoint is set, this value is ignored.
ProviderBaseURL string `json:"providerBaseURL"`
// TokenEndpoint is the fully qualified URL of the token endpoint to use to obtain
// an access token from the OAuth2 or OIDC provider.
// When this value is left empty, the client will attempt to obtain the discovery document
// from the ProviderBaseURL and use the token endpoint from that document.
TokenEndpoint string `json:"tokenEndpoint"`
}
OAuth2Config is the configuration for the OAuth2 authentication.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a simple config provider for the CLI that can fall back to a config file or environment variables. This is an alternative approach to using the viper library that was a pain to integrate with cobra in providing config file and env var defaults across multiple levels of subcommands.
The precendence of config values is as follows: 1. Flags 2. Environment variables 3. Config file 4. Flag defaults 5. Config provider defaults
Provider only supports strings, booleans, integers and floats as configuration values. Complex types such as arrays, structs and maps are not supported.
YAML, JSON and TOML are supported as config file formats.
func NewProvider ¶
func NewProvider() *Provider
NewProvider creates a new Provider of configuration values for the CLI.
func (*Provider) BindEnvVar ¶
func (*Provider) GetString ¶
GetString returns the value of a configuration value as a string. It also returns a boolean indicating whether the value was set by the user or if it's a default value. `true` means the value is a default value.