config

package
v0.0.0-...-bd16fb0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(configFile string) error

Init initializes the configuration module and loads a JSON configuration. If JSON is not existing, a default configuration will be generated.

func Load

func Load(path string) error

Load reads a configuration from a file, de-serializes it and sets it as the global configuration

func Save

func Save(conf *ManagerConfig, path string) error

Save serializes a given configuration and writes it to a file

func Set

func Set(conf *ManagerConfig)

Set sets a passed configuration as the global configuration

Types

type Database

type Database struct {
	Connections         int           `json:"connections"`           // Connections used by the manager component itself
	ConnectionsClient   int           `json:"connections_client"`    // Connections allowed for any user client
	PasswordExpiryHours float64       `json:"password_expiry_hours"` // Exact expiry interval of user access token
	PasswordExpiry      time.Duration `json:"-"`                     //
	TokenExpiryDays     float64       `json:"token_expiry_days"`     // Maximum allowed expiry interval for none user bound access token
	TokenExpiry         time.Duration `json:"-"`
}

func (*Database) UnmarshalJSON

func (d *Database) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a JSON file, validates values and populates the configuration struct

type ManagerConfig

type ManagerConfig struct {
	// The root configuration object tying all configuration segments together.
	ListenAddress    string                   `json:"listen_address"`
	PrivilegeSecrets []string                 `json:"privilege_secrets"` // Tokens granting the privilege to query full scope details, including scope secret and the scope's database credentials. E.g. the web backend does not require these details, in contrast to the broker.
	Database         Database                 `json:"database"`
	Logging          log.Settings             `json:"logging"`
	ScanDefaults     database.T_scan_settings `json:"scan_defaults"`
}

func GetConfig

func GetConfig() *ManagerConfig

GetConfig returns a pointer to the current global configuration.

Jump to

Keyboard shortcuts

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