config

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig added in v0.5.0

type AuthConfig struct {
	KeysURL            string        `split_words:"true" default:"https://auth.rotational.app/.well-known/jwks.json"`
	Audience           string        `default:"https://ensign.rotational.app"`
	Issuer             string        `default:"https://auth.rotational.app"`
	MinRefreshInterval time.Duration `split_words:"true" default:"5m"`
}

AuthConfig defines how Ensign connects to Quarterdeck in order to authorize requests.

func (AuthConfig) AuthOptions added in v0.5.0

func (c AuthConfig) AuthOptions() []middleware.AuthOption

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"`
	MetaTopic   MetaTopicConfig     `split_words:"true"`
	Monitoring  MonitoringConfig
	Storage     StorageConfig
	Auth        AuthConfig
	Radish      radish.Config
	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 New

func New() (conf Config, err error)

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

func (c Config) GetLogLevel() zerolog.Level

Parse and return the zerolog log level for configuring global logging.

func (Config) IsZero

func (c Config) IsZero() bool

A Config is zero-valued if it hasn't been processed by a file or the environment.

func (Config) Mark

func (c Config) Mark() (Config, error)

Mark a manually constructed config as processed as long as its valid.

func (Config) Path

func (c Config) Path() string

The path to the configuration file on disk when it was loaded. Returns empty string if the config was not loaded from a configuration file.

func (Config) Validate

func (c Config) Validate() (err error)

Validates the config is ready for use in the application and that configuration semantics such as requiring multiple required configuration parameters are enforced.

type MetaTopicConfig added in v0.7.0

type MetaTopicConfig struct {
	Enabled      bool   `default:"true" yaml:"enabled"`
	TopicName    string `split_words:"true" default:"ensign.metatopic.topics"`
	ClientID     string `split_words:"true"`
	ClientSecret string `split_words:"true"`
	Endpoint     string `default:"ensign.rotational.app:443"`
	AuthURL      string `split_words:"true" default:"https://auth.rotational.app"`
}

MetaTopicConfig defines the topics and events that the Ensign node publishes along with the credentials and connection endpoints to connect to Ensign on.

func (MetaTopicConfig) Validate added in v0.7.0

func (c MetaTopicConfig) Validate() error

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"`
	Testing  bool   `default:"false" yaml:"testing"`
}

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL