config

package
v1.20.3 Latest Latest
Warning

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

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

Documentation

Overview

Package config provides a struct to store the applications config

Index

Constants

This section is empty.

Variables

View Source
var AppConfig struct {
	PGDB    DBConfig
	Logging LoggingConfig
	Tracing otelx.Config
	// APIServerJWTAuth sets the JWT verification configuration for the conditionorc API service.
	APIServerJWTAuth []ginjwt.AuthConfig `mapstructure:"ginjwt_auth"`
}

AppConfig stores all the config values for our application

Functions

func MustPGDBViperFlags added in v1.20.2

func MustPGDBViperFlags(v *viper.Viper, _ *pflag.FlagSet)

MustPGDBViperFlags returns the cobra flags and viper config to prevent code duplication and help provide consistent flags across the applications

Types

type DBConfig added in v1.20.2

type DBConfig struct {
	Name        string `mapstructure:"name"`
	Host        string `mapstructure:"host"`
	User        string `mapstructure:"user"`
	Password    string `mapstructure:"password"`
	Params      string `mapstructure:"params"`
	URI         string `mapstructure:"uri"`
	Connections struct {
		MaxOpen     int           `mapstructure:"max_open"`
		MaxIdle     int           `mapstructure:"max_idle"`
		MaxLifetime time.Duration `mapstructure:"max_lifetime"`
	}
}

DBConfig is used to configure a new DB connection

func (DBConfig) GetURI added in v1.20.2

func (c DBConfig) GetURI() string

GetURI returns the connection URI, if a config URI is provided that will be returned, otherwise the host, user, password, and params will be put together to make a URI that is returned.

type LoggingConfig added in v1.20.2

type LoggingConfig struct {
	Debug             bool `mapstructure:"debug"`
	Pretty            bool `mapstructure:"pretty"`
	DisableStacktrace bool `mapstructure:"disable_stacktrace"`
}

Jump to

Keyboard shortcuts

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