config

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Maintenance  bool                `split_words:"true" default:"false"`
	BindAddr     string              `split_words:"true" default:":4437"`
	Mode         string              `split_words:"true" default:"release"`
	LogLevel     logger.LevelDecoder `split_words:"true" default:"info"`
	ConsoleLog   bool                `split_words:"true" default:"false"`
	AllowOrigins []string            `split_words:"true" default:"http://localhost,http://localhost:3000,http://localhost:3003"`
	CookieDomain string              `split_words:"true"`
	TestNet      DirectoryConfig
	MainNet      DirectoryConfig
	Database     DatabaseConfig
	Sentry       SentryConfig
	// contains filtered or unexported fields
}

Config uses envconfig to load the required settings from the environment, parse and validate them in preparation for running the GDS BFF API service.

func New

func New() (conf Config, err error)

New creates a new Config object from environment variables prefixed with GDS_BFF.

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

func (Config) IsZero

func (c Config) IsZero() bool

func (Config) Mark

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

Mark a manually constructed as processed as long as it is validated.

func (Config) Validate

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

Validate the config to make sure that it is usable to run the GDS BFF server.

type DatabaseConfig

type DatabaseConfig struct {
	URL           string `split_words:"true" required:"true"`
	ReindexOnBoot bool   `split_words:"true" default:"false"`
	Insecure      bool   `split_words:"true" default:"false"`
	CertPath      string `split_words:"true"`
	PoolPath      string `split_words:"true"`
}

func (DatabaseConfig) Validate

func (c DatabaseConfig) Validate() error

type DirectoryConfig

type DirectoryConfig struct {
	Insecure bool          `split_words:"true" default:"true"`
	Endpoint string        `split_words:"true" required:"true"`
	Timeout  time.Duration `split_words:"true" default:"10s"`
}

DirectoryConfig is a generic configuration for connecting to a GDS service.

type SentryConfig added in v1.4.1

type SentryConfig struct {
	DSN              string  `envconfig:"SENTRY_DSN"`
	Environment      string  `envconfig:"SENTRY_ENVIRONMENT"`
	Release          string  `envconfig:"SENTRY_RELEASE"`
	TrackPerformance bool    `split_words:"true" default:"false"`
	SampleRate       float64 `split_words:"true" default:"1.0"`
	Debug            bool    `default:"false"`
}

func (SentryConfig) GetRelease added in v1.4.1

func (c SentryConfig) GetRelease() string

Get the configured version string or the current semantic version if not configured.

func (SentryConfig) UseSentry added in v1.4.1

func (c SentryConfig) UseSentry() bool

func (SentryConfig) Validate added in v1.4.1

func (c SentryConfig) Validate() error

Jump to

Keyboard shortcuts

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