Documentation ¶
Overview ¶
Package sysconf provides system level configuration.
Index ¶
- func Load(dst *Config) error
- func LoadAllFromJSON(dst *Config) error
- func LoadFromArgs(dst *Config, args ...string) ([]string, error)
- func LoadFromConfigFilesJSON(dst *Config) error
- func LoadFromJSON(dst *Config, jsonData []byte) error
- func LoadFromJSONFile(dst *Config, filePath string) error
- type Certs
- type Config
- type PolicyMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load loads into dst any user supplied config from json files and CLI arguments. CLI arguments take precedence.
func LoadAllFromJSON ¶
LoadAllFromJSON populates dst with json formatted config from all dst.ConfigDirs x dst.ConfigFiles. If any file path doesn't exist then it will be skipped.
func LoadFromArgs ¶
LoadFromArgs populates fields in dst from the given command line arguments. Args should not include the program name, just like flag.FlagSet.Parse. Returns an error if the flags failed to parse or unknown flags exist.
func LoadFromConfigFilesJSON ¶
LoadFromConfigFilesJSON populates dst with json formatted config from all dst.ConfigFiles (based on current working directory).
func LoadFromJSON ¶
LoadFromJSON populates dst with the given json formatted bytes.
func LoadFromJSONFile ¶
LoadFromJSONFile reads filePath and calls LoadFromJSON.
Types ¶
type Certs ¶
type Certs struct { KeyFile string `json:"keyFile,omitempty"` CertFile string `json:"certFile,omitempty"` RootsFile string `json:"rootsFile,omitempty"` HTTPCert bool `json:"httpCert,omitempty"` // have the https stack (grpc-web and hosting) use different pki.Source from the grpc stack HTTPKeyFile string `json:"httpKeyFile,omitempty"` HTTPCertFile string `json:"httpCertFile,omitempty"` }
Certs encapsulates different settings used for loading and present certificates to clients and servers.
func (*Certs) FillDefaults ¶
type Config ¶
type Config struct { ConfigDirs []string `json:"-"` // Dirs to look in for system config files. Defaults to [".conf"] ConfigFiles []string `json:"-"` // Filenames we load in ConfigDirs for system config. Defaults to ["system.conf.json", "system.json"] // The smart core name of the controller. // Can be overridden by app config. Name string `json:"name,omitempty"` Logger *zap.Config `json:"logger,omitempty"` ListenGRPC string `json:"listenGrpc,omitempty"` ListenHTTPS string `json:"listenHttps,omitempty"` // FooAddr are preferred IP/host others use to connect to us. // Defaults to netutil.PublicAddress GRPCAddr string `json:"grpcAddr,omitempty"` HTTPAddr string `json:"httpAddr,omitempty"` AppConfig []string `json:"appConfig,omitempty"` // defaults to [".conf/app.conf.json"] DataDir string `json:"dataDir,omitempty"` // defaults to .data/ StaticHosting []http.StaticHostingConfig `json:"staticHosting"` CertConfig *Certs `json:"certs,omitempty"` Cors http.CorsConfig `json:"cors,omitempty"` Systems map[string]system.RawConfig `json:"systems,omitempty"` Policy policy.Policy `json:"-"` // Override the policy used for RPC calls. Defaults to policy.Default PolicyMode PolicyMode `json:"-"` // How to apply the policy. Unsafe and can disable security checks. Defaults to PolicyOn. DriverFactories map[string]driver.Factory `json:"-"` // keyed by driver name AutoFactories map[string]auto.Factory `json:"-"` // keyed by automation type SystemFactories map[string]system.Factory `json:"-"` // keyed by system type ZoneFactories map[string]zone.Factory `json:"-"` // keyed by zone type }
Config configures how the controller should run.
type PolicyMode ¶
type PolicyMode string
const ( PolicyOn PolicyMode = "on" // Always check requests against the policy. PolicyOff PolicyMode = "off" // Never check requests against the policy, allow all requests. PolicyCheck PolicyMode = "check" // Check requests against the policy if the request has a token or client cert. )
func (*PolicyMode) Set ¶
func (pm *PolicyMode) Set(s string) error
func (*PolicyMode) String ¶
func (pm *PolicyMode) String() string