config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoDBConnectionString is an error, raised when no database connection string is configured.
	ErrNoDBConnectionString = errors.New("no database connection string")

	// ErrNoProvisioningFile is an error, raised when no provisioning file is configured.
	ErrNoProvisioningFile = errors.New("no provisioning file")

	// ErrNoServerAddress is an error, raised when no server address is configured.
	ErrNoServerAddress = errors.New("no server address")
	// ErrNoAllowedOrigins is an error, raised when no allowed origins is configured.
	ErrNoAllowedOrigins = errors.New("no allowed origins")

	// ErrNoMetricNamespace is an error, raised when no metric namespace is configured.
	ErrNoMetricNamespace = errors.New("no metrics namespace")
	// ErrNoMetricSubsystem is an error, raised when no metric subsystem is configured.
	ErrNoMetricSubsystem = errors.New("no metrics subsystem")
)

Functions

This section is empty.

Types

type CORS

type CORS struct {
	AllowedOrigins []string
	Enabled        bool
}

CORS holds the configuration regarding the CORS settings.

type Config

type Config struct {
	ProvisioningFile string
	Metrics          Metrics
	Database         Database
	Server           Server
	Verbose          int
	ShutdownTimeout  time.Duration
}

Config holds all application configuration.

func New

func New() (*Config, error)

New creates a new configuration.

func (Config) IsValid

func (c Config) IsValid() error

IsValid validates the config by checking own values and calling isValid on sub config objects.

type Database

type Database struct {
	ConnectionString string `json:"-"` // do not leak database password when logging.
}

Database holds configuration regarding the database connection.

type Metrics

type Metrics struct {
	Namespace string
	Subsystem string
	Address   string
}

Metrics holds configuration regarding the metrics server.

type Server

type Server struct {
	Address        string
	CORS           CORS
	SwaggerEnabled bool
}

Server holds configuration regarding the api server.

Jump to

Keyboard shortcuts

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