Documentation
¶
Overview ¶
Package config discovers and resolves .blip.toml.
Index ¶
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout applies when an environment does not set one.
Variables ¶
var ErrNotFound = errors.New("no .blip.toml found in this directory or any parent; run \"blip init <base-url>\" to create one")
ErrNotFound means no config file exists between cwd and the filesystem root.
var Names = []string{".blip.toml", "blip.toml"}
Names blip looks for, in order, at each level of the walk up from cwd.
Functions ¶
func IsLocalHost ¶
IsLocalHost reports whether a host is loopback, and so whether relaxing TLS against it is a local development concern rather than a real exposure.
Types ¶
type Config ¶
Config is a parsed file plus where it was found.
func (*Config) ResolveEnv ¶
func (c *Config) ResolveEnv(explicit string) (*Environment, error)
ResolveEnv picks an environment: explicit flag, then BLIP_ENV, then default_env, then the sole environment if there is exactly one.
type Env ¶
type Env struct {
BaseURL string `toml:"base_url"`
SpecURL string `toml:"spec_url"`
Insecure bool `toml:"insecure"`
Auth string `toml:"auth"`
Timeout string `toml:"timeout"`
Readonly bool `toml:"readonly"`
ClientCert string `toml:"client_cert"`
ClientKey string `toml:"client_key"`
}
Env is one environment block as written in the file.
type Environment ¶
type Environment struct {
Name string
BaseURL *url.URL
SpecURL string
Insecure bool
Auth string
Timeout time.Duration
Readonly bool
ClientCert string
ClientKey string
}
Environment is a validated environment, ready to make requests against.