conf

package
v0.0.0-...-46980f1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigOrDie

func GetConfigOrDie[C any]() C

Create a new configuration from the default config json file.

This will read two files:

  • /etc/config/conf.json
  • /etc/secrets/secrets.json

The values read from secrets.json will override the values in conf.json

Types

type Config

type Config interface {
	GetDBConfig() DBConfig
	GetMonitoringConfig() MonitoringConfig
	GetKeystoneConfig() KeystoneConfig
	// Check if the configuration is valid.
	Validate() error
}

Configuration for the cortex service.

type DBConfig

type DBConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Database string `json:"database"`
	User     string `json:"user"`
	Password string `json:"password"`
}

Database configuration.

type JsonOpts

type JsonOpts[Options any] struct {
	// Options loaded from a json config using the Load method.
	Options Options
}

Mixin that adds the ability to load options from a json map. Usage: type StructUsingOpts struct { conf.JsonOpts[MyOpts] }

func (*JsonOpts[Options]) Load

func (s *JsonOpts[Options]) Load(opts RawOpts) error

Set the options contained in the opts json map.

type KeystoneConfig

type KeystoneConfig struct {
	// The URL of the keystone service.
	URL string `json:"url"`
	// Availability of the keystone service, such as "public", "internal", or "admin".
	Availability string `json:"availability"`
	// The OpenStack username (OS_USERNAME in openstack cli).
	OSUsername string `json:"username"`
	// The OpenStack password (OS_PASSWORD in openstack cli).
	OSPassword string `json:"password"`
	// The OpenStack project name (OS_PROJECT_NAME in openstack cli).
	OSProjectName string `json:"projectName"`
	// The OpenStack user domain name (OS_USER_DOMAIN_NAME in openstack cli).
	OSUserDomainName string `json:"userDomainName"`
	// The OpenStack project domain name (OS_PROJECT_DOMAIN_NAME in openstack cli).
	OSProjectDomainName string `json:"projectDomainName"`
}

Configuration for the keystone authentication.

type MonitoringConfig

type MonitoringConfig struct {
	// The labels to add to all metrics.
	Labels map[string]string `json:"labels"`

	// The port to expose the metrics on.
	Port int `json:"port"`
}

Configuration for the monitoring module.

type RawOpts

type RawOpts struct {
	// contains filtered or unexported fields
}

Raw options that are not directly unmarshalled when loading from json. Usage: call Unmarshal to unmarshal the options into a struct.

func NewRawOpts

func NewRawOpts(rawJson string) RawOpts

Create a new RawOpts instance with the given json string.

func NewRawOptsBytes

func NewRawOptsBytes(rawJson []byte) RawOpts

func (*RawOpts) Unmarshal

func (msg *RawOpts) Unmarshal(v any) error

Call the postponed unmarshal function and unmarshal the options into a struct.

func (*RawOpts) UnmarshalJSON

func (msg *RawOpts) UnmarshalJSON(data []byte) error

Override the default json unmarshal behavior to postpone the unmarshal.

type SSOConfig

type SSOConfig struct {
	Cert    string `json:"cert,omitempty"`
	CertKey string `json:"certKey,omitempty"`

	// If the certificate is self-signed, we need to skip verification.
	SelfSigned bool `json:"selfSigned,omitempty"`
}

Configuration for single-sign-on (SSO).

type SharedConfig

type SharedConfig struct {
	DBConfig         `json:"db"`
	MonitoringConfig `json:"monitoring"`
	KeystoneConfig   `json:"keystone"`
}

func (*SharedConfig) GetDBConfig

func (c *SharedConfig) GetDBConfig() DBConfig

func (*SharedConfig) GetKeystoneConfig

func (c *SharedConfig) GetKeystoneConfig() KeystoneConfig

func (*SharedConfig) GetMonitoringConfig

func (c *SharedConfig) GetMonitoringConfig() MonitoringConfig

func (*SharedConfig) Validate

func (c *SharedConfig) Validate() error

Check if all dependencies are satisfied.

Jump to

Keyboard shortcuts

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