config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 6 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 {
	Name           string          `envconfig:"RVASP_NAME"`
	BindAddr       string          `envconfig:"RVASP_BIND_ADDR" default:":4434"`
	TRISABindAddr  string          `envconfig:"RVASP_TRISA_BIND_ADDR" default:":4435"`
	FixturesPath   string          `envconfig:"RVASP_FIXTURES_PATH"`
	CertPath       string          `envconfig:"RVASP_CERT_PATH"`
	TrustChainPath string          `envconfig:"RVASP_TRUST_CHAIN_PATH"`
	AsyncInterval  time.Duration   `envconfig:"RVASP_ASYNC_INTERVAL" default:"1m"`
	AsyncNotBefore time.Duration   `envconfig:"RVASP_ASYNC_NOT_BEFORE" default:"5m"`
	AsyncNotAfter  time.Duration   `envconfig:"RVASP_ASYNC_NOT_AFTER" default:"1h"`
	ConsoleLog     bool            `envconfig:"RVASP_CONSOLE_LOG" default:"false"`
	LogLevel       LogLevelDecoder `envconfig:"RVASP_LOG_LEVEL" default:"info"`
	GDS            GDSConfig
	Database       DatabaseConfig
	Activity       activity.Config
}

Config uses envconfig to load required settings from the environment and validate them in preparation for running the rVASP.

TODO: also store separate signing key instead of using the cert key.

func New

func New() (_ *Config, err error)

New creates a new Config object, loading environment variables and defaults.

type DatabaseConfig

type DatabaseConfig struct {
	DSN        string `split_words:"true"`
	MaxRetries int    `split_words:"true" default:"0"`
}

DatabaseConfig is the configuration for connecting to the RVASP database

type GDSConfig

type GDSConfig struct {
	URL      string `split_words:"true" default:"api.trisatest.net:443"`
	Insecure bool   `split_words:"true" default:"false"`
}

GDSConfig is the configuration for connecting to GDS

type LogLevelDecoder

type LogLevelDecoder zerolog.Level

LogLevelDecoder deserializes the log level from a config string.

func (*LogLevelDecoder) Decode

func (ll *LogLevelDecoder) Decode(value string) error

Decode implements envconfig.Decoder

Jump to

Keyboard shortcuts

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