{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package config\n\n## Variables\n\n```go\nvar (\n\t// ErrUnsupportedConfigFileFormat is returned when the config file format\n\t// is not supported by the provider.\n\tErrUnsupportedConfigFileFormat = errors.New(\"unsupported config file format, only yaml, json and toml are supported\")\n)\n```\n\n## Functions\n\n```go\nfunc LoadOperationConfig(confProvider *Provider) (*types.BlueprintOperationConfig, error)\n```\nLoadOperationConfig loads the blueprint operation config (provider, transformer, context variable and blueprint variable values) from the deploy config file recorded in the \"deployConfigFile\" config key.\n\nThe deploy config file is typically produced by a CLI's PreCommandStep (e.g. Celerity converts app.deploy.jsonc into .celerity/deploy-config.json and points deployConfigFile at it). It carries values such as the deploy target that provider and transformer plugins require during validation, change staging and deployment; without it the engine invokes plugins with an empty deploy target.\n\nReturns (nil, nil) when no deploy config file is configured, or when the configured path is the default and no file exists there, so callers can pass the result straight through to a payload's Config field. A path the user set must exist.\n\n## Types\n\n```go\ntype BluelinkSignatureV1Config struct {\n\tKeyPair       BluelinkSignatureV1KeyPair `json:\"keyPair\"`\n\tCustomHeaders []string                   `json:\"customHeaders\"`\n}\n```\nBluelinkSignatureV1Config is the configuration for the Bluelink Signature v1 authentication.\n\n```go\ntype BluelinkSignatureV1KeyPair struct {\n\tKeyID     string `json:\"keyId\"`\n\tSecretKey string `json:\"secretKey\"`\n}\n```\nBluelinkSignatureV1KeyPair is the key pair for the Bluelink Signature v1 authentication.\n\n```go\ntype EngineAuthConfig struct {\n\tMethod              string                     `json:\"method\"`\n\tAPIKey              string                     `json:\"apiKey\"`\n\tOAuth2              *OAuth2Config              `json:\"oauth2\"`\n\tBluelinkSignatureV1 *BluelinkSignatureV1Config `json:\"bluelinkSignatureV1\"`\n}\n```\nEngineAuthConfig is the configuration for the deploy engine authentication.\n\n```go\nfunc LoadEngineAuthConfig(confProvider *Provider) (*EngineAuthConfig, error)\n```\nLoadEngineAuthConfig loads the engine authentication configuration from an auth config file.\n\n```go\ntype OAuth2Config struct {\n\t// ClientID is used as a part of the client credentials grant type\n\t// to obtain an access token from the OAuth2 or OIDC provider.\n\tClientID string `json:\"clientId\"`\n\t// ClientSecret is used as a part of the client credentials grant type\n\t// to obtain an access token from the OAuth2 or OIDC provider.\n\tClientSecret string `json:\"clientSecret\"`\n\t// ProviderBaseURL is the base URL of the OAuth2 or OIDC provider.\n\t// This is the URL from which the client will use to obtain\n\t// the discovery document for the provider at either `/.well-known/openid-configuration`\n\t// or `/.well-known/oauth-authorization-server`.\n\t// When TokenEndpoint is set, this value is ignored.\n\tProviderBaseURL string `json:\"providerBaseURL\"`\n\t// TokenEndpoint is the fully qualified URL of the token endpoint to use to obtain\n\t// an access token from the OAuth2 or OIDC provider.\n\t// When this value is left empty, the client will attempt to obtain the discovery document\n\t// from the ProviderBaseURL and use the token endpoint from that document.\n\tTokenEndpoint string `json:\"tokenEndpoint\"`\n}\n```\nOAuth2Config is the configuration for the OAuth2 authentication.\n\n```go\ntype Provider struct {\n\t// contains filtered or unexported fields\n}\n```\nProvider 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.\n\nThe precendence of config values is as follows: 1. Flags 2. Environment variables 3. Config file 4. Flag defaults 5. Config provider defaults\n\nProvider only supports strings, booleans, integers and floats as configuration values. Complex types such as arrays, structs and maps are not supported.\n\nYAML, JSON and TOML are supported as config file formats.\n\n```go\nfunc NewProvider() *Provider\n```\nNewProvider creates a new Provider of configuration values for the CLI.\n\n```go\nfunc (p *Provider) BindEnvVar(configName, envVarName string)\n```\n\n```go\nfunc (p *Provider) BindPFlag(configName string, flag *pflag.Flag)\n```\n\n```go\nfunc (p *Provider) GetBool(configName string) (bool, bool)\n```\n\n```go\nfunc (p *Provider) GetFloat32(configName string) (float32, bool)\n```\n\n```go\nfunc (p *Provider) GetFloat64(configName string) (float64, bool)\n```\n\n```go\nfunc (p *Provider) GetInt32(configName string) (int32, bool)\n```\n\n```go\nfunc (p *Provider) GetInt64(configName string) (int64, bool)\n```\n\n```go\nfunc (p *Provider) GetString(configName string) (string, bool)\n```\nGetString 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.\n\n```go\nfunc (p *Provider) GetUint32(configName string) (uint32, bool)\n```\n\n```go\nfunc (p *Provider) GetUint64(configName string) (uint64, bool)\n```\n\n```go\nfunc (p *Provider) LoadConfigFile(configFilePath string) error\n```\n\n```go\nfunc (p *Provider) Set(configName, value string)\n```\nSet records a value the CLI derived while running, for later steps to read.\n\nThis overrides everything but a flag the user passed explicitly, which is what separates it from SetDefault. For example, a pre-command step producing a generated file for the command proper to consume is the case this exists for.\n\n```go\nfunc (p *Provider) SetDefault(configName, value string)\n```\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/config","name":"config","synopsis":"","isRedistributable":true}
