Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// The API server address, this should correspond exactly to value of the
// audience specified during token exchanges.
Server string `json:"server" yaml:"server" env:"STORMFORGE_SERVER" envDefault:"https://api.stormforge.io/"`
// The API authorization server address, this should correspond exactly to
// the expected issuer claim of the tokens being used.
Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty" env:"STORMFORGE_ISSUER" envDefault:"https://auth.stormforge.io/"`
// The client ID used to obtain tokens via a client credentials grant.
ClientID string `json:"client_id,omitempty" yaml:"client_id,omitempty" env:"STORMFORGE_CLIENT_ID"`
// The client secret used to obtain tokens via a client credentials grant.
ClientSecret string `json:"client_secret,omitempty" yaml:"client_secret,omitempty" env:"STORMFORGE_CLIENT_SECRET"`
// The list of scopes to request during token exchanges.
Scopes []string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
// A hard-coded bearer token for debugging, the token will not be refreshed
// so the caller is responsible for providing a valid token.
Token string `json:"-" yaml:"-" env:"STORMFORGE_TOKEN"`
}
Config is a simple top level configuration object for client configuration.
func (*Config) Address ¶ added in v0.1.0
Address returns the API server address. The canonical value will be slash-terminated, however it is not guaranteed and callers are responsible for sanitizing the value.
func (*Config) TokenSource ¶ added in v0.1.0
func (cfg *Config) TokenSource(ctx context.Context) oauth2.TokenSource
TokenSource returns a new source for obtaining tokens. The token source may be nil if there is insufficient configuration available, typically this would indicate the API server does not require authorization.
func (*Config) Transport ¶ added in v0.1.0
func (cfg *Config) Transport(ctx context.Context, base http.RoundTripper) http.RoundTripper
Transport wraps the supplied round tripper (presumably the `http.DefaultTransport`) based on the current state of the configuration.
Click to show internal directories.
Click to hide internal directories.