config

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestNet = "testnet"
	MainNet = "mainnet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityConfig added in v1.7.3

type ActivityConfig struct {
	Enabled bool   `split_words:"true" default:"false"`
	Topic   string `split_words:"true"`
	Ensign  ensign.Config
}

type AuthConfig added in v1.5.0

type AuthConfig struct {
	Domain        string        `split_words:"true" required:"true"`
	Issuer        string        `split_words:"true" required:"false"` // Set to the custom domain if enabled in Auth0 (ensure trailing slash is set if required!)
	Audience      string        `split_words:"true" required:"true"`
	ProviderCache time.Duration `split_words:"true" default:"5m"`
	ClientID      string        `split_words:"true"`
	ClientSecret  string        `split_words:"true"`
	Testing       bool          `split_words:"true" default:"false"` // If true a mock authenticator is used for testing
}

AuthConfig handles Auth0 configuration and authentication

func (AuthConfig) ClientCredentials added in v1.5.0

func (c AuthConfig) ClientCredentials() management.Option

func (AuthConfig) IssuerURL added in v1.5.0

func (c AuthConfig) IssuerURL() (u *url.URL, err error)

func (AuthConfig) Validate added in v1.5.0

func (c AuthConfig) Validate() error

type CacheConfig added in v1.6.1

type CacheConfig struct {
	Enabled    bool          `split_words:"true" default:"false"`
	Size       uint          `split_words:"true" default:"16384"`
	Expiration time.Duration `split_words:"true" default:"8h"`
}

func (CacheConfig) Validate added in v1.6.1

func (c CacheConfig) Validate() error

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"`
	RegisterURL  string              `split_words:"true" required:"true"` // Trailing slash is not allowed
	LoginURL     string              `split_words:"true" required:"true"` // Trailing slash is not allowed
	CookieDomain string              `split_words:"true"`
	ServeDocs    bool                `split_words:"true" default:"false"`
	UserCache    CacheConfig         `split_words:"true"`
	Auth0        AuthConfig
	TestNet      NetworkConfig
	MainNet      NetworkConfig
	Database     config.StoreConfig
	Email        EmailConfig
	Sentry       sentry.Config
	Activity     activity.Config
	// 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 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 EmailConfig added in v1.6.0

type EmailConfig struct {
	ServiceEmail   string `envconfig:"GDS_BFF_SERVICE_EMAIL" default:"TRISA Directory Service <admin@vaspdirectory.net>"`
	SendGridAPIKey string `envconfig:"SENDGRID_API_KEY" required:"false"`
	Testing        bool   `split_words:"true" default:"false"`
	Storage        string `split_words:"true" default:""`
}

EmailConfig defines how emails are sent from the BFF.

func (EmailConfig) Validate added in v1.6.0

func (c EmailConfig) Validate() error

type MTLSConfig added in v1.5.0

type MTLSConfig struct {
	Insecure bool   `split_words:"true"`
	CertPath string `split_words:"true"`
	PoolPath string `split_words:"true"`
}

func (MTLSConfig) DialOption added in v1.5.0

func (c MTLSConfig) DialOption(endpoint string) (opt grpc.DialOption, err error)

DialOption returns a configured dial option which can be directly used in a grpc.Dial or grpc.DialContext call to connect using mTLS.

func (MTLSConfig) Validate added in v1.5.0

func (c MTLSConfig) Validate() error

type MembersConfig added in v1.5.0

type MembersConfig struct {
	Endpoint string        `split_words:"true" required:"true"`
	Timeout  time.Duration `split_words:"true" default:"10s"`
	MTLS     MTLSConfig
}

MembersConfig is a configuration for connecting to a members service.

func (MembersConfig) Validate added in v1.5.0

func (c MembersConfig) Validate() error

type NetworkConfig added in v1.5.0

type NetworkConfig struct {
	Database  config.StoreConfig
	Directory DirectoryConfig
	Members   MembersConfig
}

NetworkConfig contains sub configurations for connecting to specific GDS and members services.

func (NetworkConfig) Validate added in v1.5.0

func (c NetworkConfig) Validate() error

Jump to

Keyboard shortcuts

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