Documentation
¶
Overview ¶
Package config creates a client configuration from various sources.
Index ¶
- Variables
- func DefaultSecretsDir(u upspin.UserName) (string, error)
- func FromFile(name string) (upspin.Config, error)
- func Home() string
- func Homedir() (string, error)
- func InitConfig(r io.Reader) (upspin.Config, error)
- func New() upspin.Config
- func SetDirEndpoint(cfg upspin.Config, e upspin.Endpoint) upspin.Config
- func SetFactotum(cfg upspin.Config, f upspin.Factotum) upspin.Config
- func SetFlagValues(cfg upspin.Config, cmd string) error
- func SetKeyEndpoint(cfg upspin.Config, e upspin.Endpoint) upspin.Config
- func SetPacking(cfg upspin.Config, p upspin.Packing) upspin.Config
- func SetStoreEndpoint(cfg upspin.Config, e upspin.Endpoint) upspin.Config
- func SetUserName(cfg upspin.Config, u upspin.UserName) upspin.Config
- func SetValue(cfg upspin.Config, key, val string) upspin.Config
- func User(ctx upspin.Config) *upspin.User
Constants ¶
This section is empty.
Variables ¶
var ErrNoFactotum = errors.Str("factotum not initialized: no secrets provided")
ErrNoFactotum indicates that the returned config contains no Factotum, and that the user requested this by setting secrets=none in the configuration.
Functions ¶
func DefaultSecretsDir ¶
DefaultSecretsDir returns the default directory in which the given user's Upspin key pair should be kept ($HOME/.ssh/$USERNAME).
func FromFile ¶
FromFile initializes a config using the given file. If the file cannot be opened but the name can be found in $HOME/upspin, that file is used.
func Home ¶
func Home() string
Home returns the home directory of the user, or panics if it cannot find one.
func Homedir ¶
Homedir returns the home directory of the OS' logged-in user. TODO(adg): move to osutil package?
func InitConfig ¶
InitConfig returns a config generated by parsing the contents of the io.Reader, typically a configuration file.
A configuration file should be of the format
# lines that begin with a hash are ignored key = value
where key may be one of username, keyserver, dirserver, storeserver, packing, secrets, or tlscerts.
The default configuration file location is $HOME/upspin/config. If passed a non-nil io.Reader, that is used instead of the default file.
Any endpoints (keyserver, dirserver, storeserver) not set in the data for the config will be set to the "unassigned" transport and an empty network address, except keyserver which defaults to "remote,key.upspin.io:443". If an endpoint is specified without a transport it is assumed to be the address component of a remote endpoint. If a remote endpoint is specified without a port in its address component the port is assumed to be 443.
The default value for packing is "ee".
The default value for secrets is "$HOME/.ssh/$USERNAME". The special value "none" indicates there are no secrets to load; in this case, the returned config will not include a Factotum and the returned error is ErrNoFactotum.
The tlscerts key specifies a directory containing PEM certificates define the certificate pool used for verifying client TLS connections, replacing the root certificate list provided by the operating system. Files without the suffix ".pem" are ignored. The default value for tlscerts is the empty string, in which case just the system roots are used.
func SetDirEndpoint ¶
SetDirEndpoint returns a config derived from the given config with the given dir endpoint.
func SetFactotum ¶
SetFactotum returns a config derived from the given config with the given factotum.
func SetFlagValues ¶
SetFlagValues updates any flag that is still at its default value. It will apply all the flags possible and return the last error seen.
func SetKeyEndpoint ¶
SetKeyEndpoint returns a config derived from the given config with the given key endpoint.
func SetPacking ¶
SetPacking returns a config derived from the given config with the given packing.
func SetStoreEndpoint ¶
SetStoreEndpoint returns a config derived from the given config with the given store endpoint.
func SetUserName ¶
SetUserName returns a config derived from the given config with the given user name.
Types ¶
This section is empty.