config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "exchequer"

All environment variables will have this prefix unless otherwise defined in struct tags. For example, the conf.LogLevel environment variable will be EXCHEQUER_LOG_LEVEL because of this prefix and the split_words struct tag in the conf below.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdyenConfig added in v0.2.0

type AdyenConfig struct {
	MerchantAccount string `split_words:"true" required:"true" desc:"the merchant account name configured in adyen"`
	APIKey          string `split_words:"true" required:"true" desc:"api key for adyen payments api access"`
	ClientKey       string `split_words:"true" required:"true" desc:"client key for adyen web drop-in"`
	Live            bool   `default:"false" desc:"set to true to enable live payments and access to the live environment"`
	URLPrefix       string `split_words:"true" desc:"the live endpoint url prefix used to access the live environment"`
	Webhook         AdyenWebhookConfig
}

func (AdyenConfig) Validate added in v0.2.0

func (c AdyenConfig) Validate() error

type AdyenWebhookConfig added in v0.2.0

type AdyenWebhookConfig struct {
	UseBasicAuth bool   `split_words:"true" default:"false" desc:"verify adyen webhooks with basic authentication"`
	Username     string `default:"" desc:"if basic auth is enabled, provide the configured username"`
	Password     string `default:"" desc:"if basic auth is enabled, provide the configured password in plaintext"`
	VerifyHMAC   bool   `split_words:"true" default:"false" desc:"if true, verify the hmac in the additional details of the webhook"`
	HMACSecret   string `split_words:"true" desc:"specify the configured hmac secret for message verification"`
}

func (AdyenWebhookConfig) Validate added in v0.2.0

func (c AdyenWebhookConfig) Validate() error

type Config

type Config struct {
	Maintenance bool                `default:"false" desc:"if true, the node will start in maintenance mode"`
	Mode        string              `default:"release" desc:"specify the mode of the server (release, debug, testing)"`
	LogLevel    logger.LevelDecoder `split_words:"true" default:"info" desc:"specify the verbosity of logging (trace, debug, info, warn, error, fatal panic)"`
	ConsoleLog  bool                `split_words:"true" default:"false" desc:"if true logs colorized human readable output instead of json"`
	BindAddr    string              `split_words:"true" default:"8204" desc:"the ip address and port to bind the web service on"`
	Origin      string              `default:"http://localhost:8204" desc:"origin (url) of the user interface for CORS access"`
	Adyen       AdyenConfig
	// contains filtered or unexported fields
}

Config contains all of the configuration parameters for the service 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 server to ensure that all server operations work as expected.

func New

func New() (conf Config, err error)

func (Config) GetLogLevel

func (c Config) GetLogLevel() zerolog.Level

func (Config) IsZero

func (c Config) IsZero() bool

Returns true if the config has not been correctly processed from the environment.

func (Config) Validate

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

Custom validations are added here, particularly validations that require one or more fields to be processed before the validation occurs. NOTE: ensure that all nested config validation methods are called here.

Jump to

Keyboard shortcuts

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