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"` Monitoring MonitoringConfig Storage StorageConfig Sentry sentry.Config // 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.
type StorageConfig ¶ added in v0.4.0
type StorageConfig struct { ReadOnly bool `default:"false" split_words:"true" yaml:"read_only"` DataPath string `split_words:"true" yaml:"data_path"` }
StorageConfig defines on disk where Ensign keeps its data. Users must specify the DataPath directory where Ensign will store it's data.
func (StorageConfig) EventPath ¶ added in v0.4.0
func (c StorageConfig) EventPath() (path string, err error)
EventPath returns the path to the event data store for Ensign, checking to make sure that the directory exists and that it is a directory. If it doesn't exist, the directory is created; an error is returned if the path is invalid or cannot be created.
func (StorageConfig) MetaPath ¶ added in v0.4.0
func (c StorageConfig) MetaPath() (path string, err error)
MetaPath returns the path to the metadata store for Ensign, checking to make sure that the directory exists and that it is a directory. If it doesn't exist, the directory is created; an error is returned if the path is invalid or cannot be created.
func (StorageConfig) Validate ¶ added in v0.4.0
func (c StorageConfig) Validate() (err error)