Documentation
¶
Overview ¶
Package config contains a centralized structure for all configuration options.
Index ¶
- func RegisterDatabaseFlags(v *viper.Viper, flags *pflag.FlagSet) error
- func RegisterGRPCServerFlags(v *viper.Viper, flags *pflag.FlagSet) error
- func RegisterHTTPServerFlags(v *viper.Viper, flags *pflag.FlagSet) error
- func SetCryptoViperDefaults(v *viper.Viper)
- func SetLoggingViperDefaults(v *viper.Viper)
- func SetMetricsViperDefaults(v *viper.Viper)
- func SetTracingViperDefaults(v *viper.Viper)
- func SetViperDefaults(v *viper.Viper)
- type Config
- type CryptoConfig
- type DatabaseConfig
- type GRPCServerConfig
- type HTTPServerConfig
- type LoggingConfig
- type MetricsConfig
- type TracingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDatabaseFlags ¶
RegisterDatabaseFlags registers the flags for the database configuration
func RegisterGRPCServerFlags ¶
RegisterGRPCServerFlags registers the flags for the gRPC server
func RegisterHTTPServerFlags ¶
RegisterHTTPServerFlags registers the flags for the HTTP server
func SetCryptoViperDefaults ¶
SetCryptoViperDefaults sets the default values for the crypto configuration to be picked up by viper
func SetLoggingViperDefaults ¶
SetLoggingViperDefaults sets the default values for the logging configuration to be picked up by viper
func SetMetricsViperDefaults ¶
SetMetricsViperDefaults sets the default values for the metrics configuration to be picked up by viper
func SetTracingViperDefaults ¶
SetTracingViperDefaults sets the default values for the tracing configuration to be picked up by viper
func SetViperDefaults ¶
SetViperDefaults sets the default values for the configuration to be picked up by viper
Types ¶
type Config ¶
type Config struct {
HTTPServer HTTPServerConfig `mapstructure:"http_server"`
GRPCServer GRPCServerConfig `mapstructure:"grpc_server"`
LoggingConfig LoggingConfig `mapstructure:"logging"`
Tracing TracingConfig `mapstructure:"tracing"`
Metrics MetricsConfig `mapstructure:"metrics"`
Database DatabaseConfig `mapstructure:"database"`
Salt CryptoConfig `mapstructure:"salt"`
}
Config is the top-level configuration structure.
type CryptoConfig ¶
type CryptoConfig struct {
Memory uint32 `mapstructure:"memory"`
Iterations uint32 `mapstructure:"iterations"`
Parallelism uint `mapstructure:"parallelism"`
SaltLength uint32 `mapstructure:"salt_length"`
KeyLength uint32 `mapstructure:"key_length"`
}
CryptoConfig is the configuration for the crypto package
func GetCryptoConfigWithDefaults ¶
func GetCryptoConfigWithDefaults() CryptoConfig
GetCryptoConfigWithDefaults returns a CryptoConfig with default values
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `mapstructure:"dbhost"`
Port int `mapstructure:"dbport"`
User string `mapstructure:"dbuser"`
Password string `mapstructure:"dbpass"`
Name string `mapstructure:"dbname"`
SSLMode string `mapstructure:"sslmode"`
// If set, use credentials from the specified cloud provider.
// Currently supported values are `aws`
CloudProviderCredentials string `mapstructure:"cloud_provider_credentials"`
AWSRegion string `mapstructure:"aws_region"`
// contains filtered or unexported fields
}
DatabaseConfig is the configuration for the database
func (*DatabaseConfig) GetDBConnection ¶
GetDBConnection returns a connection to the database
type GRPCServerConfig ¶
type GRPCServerConfig struct {
// Host is the host to bind to
Host string `mapstructure:"host"`
// Port is the port to bind to
Port int `mapstructure:"port"`
}
GRPCServerConfig is the configuration for the gRPC server
func (*GRPCServerConfig) GetAddress ¶
func (s *GRPCServerConfig) GetAddress() string
GetAddress returns the address to bind to
type HTTPServerConfig ¶
type HTTPServerConfig struct {
// Host is the host to bind to
Host string `mapstructure:"host"`
// Port is the port to bind to
Port int `mapstructure:"port"`
}
HTTPServerConfig is the configuration for the HTTP server
func (*HTTPServerConfig) GetAddress ¶
func (s *HTTPServerConfig) GetAddress() string
GetAddress returns the address to bind to
type LoggingConfig ¶
type LoggingConfig struct {
Level string `mapstructure:"level"`
Format string `mapstructure:"format"`
LogFile string `mapstructure:"logFile"`
}
LoggingConfig is the configuration for the logging package
type MetricsConfig ¶
type MetricsConfig struct {
Enabled bool `mapstructure:"enabled"`
}
MetricsConfig is the configuration for the metrics
type TracingConfig ¶
type TracingConfig struct {
Enabled bool `mapstructure:"enabled"`
// for the demonstration, we use AlwaysSmaple sampler to take all spans.
// do not use this option in production.
SampleRatio float64 `mapstructure:"sample_ratio"`
}
TracingConfig is the configuration for our tracing capabilities