Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetLocalEnviron ¶
func ResetLocalEnviron()
Reset the environment used by checkEnv (primarily for testing).
Types ¶
type Config ¶
type Config struct {
Maintenance bool `default:"false" yaml:"maintenance"`
LogLevel logger.LevelDecoder `split_words:"true" default:"info" yaml:"log_level"`
ConsoleLog bool `split_words:"true" default:"false" yaml:"console_log"`
BindAddr string `split_words:"true" default:":5356" yaml:"bind_addr"`
Sentry sentry.Config
Monitoring MonitoringConfig
// contains filtered or unexported fields
}
Config contains all of the configuration parameters for an Ensign server and is loaded from the environment or a configuration file with reasonable defaults for values that are omitted. The Config should be validated in preparation for running the Ensign server to ensure that all server operations work as expected.
func Load ¶
Load and process a Config from the specified configuration file, then process the configuration from the environment. If the configuration is invalid or cannot be processed either from the file or the environment, then an error is returned. The configuration file is processed based on its file extension. YAML files with a .yaml or .yml extension are preferred, but JSON (.json) and TOML (.toml) files will also be processed. If the path has an unrecognized extension an error is returned. HACK: this is a beta function right now and is not fully tested; use with care!
func New ¶
New creates and processes a Config from the environment ready for use. If the configuration is invalid or it cannot be processed an error is returned.
func (Config) GetLogLevel ¶
Parse and return the zerolog log level for configuring global logging.
func (Config) IsZero ¶
A Config is zero-valued if it hasn't been processed by a file or the environment.
type MonitoringConfig ¶
type MonitoringConfig struct {
Enabled bool `default:"true" yaml:"enabled"`
BindAddr string `split_words:"true" default:":1205" yaml:"bind_addr"`
NodeID string `split_words:"true" required:"false" yaml:"node"`
}
MonitoringConfig maintains the parameters for the o11y server that the Prometheus scraper will fetch the configured observability metrics from.