config

package
v0.0.0-...-eac0ad2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtractSectionsResult

type ExtractSectionsResult struct {
	fx.Out

	ServerConfig      ServerConfig
	ServerHTTPConfig  ServerHTTPConfig
	ServerDBConfig    ServerDBConfig
	ServerRedisConfig ServerRedisConfig
	ServerMinIOConfig ServerMinIOConfig
	ServerNATSConfig  ServerNATSConfig
	SnowflakeConfig   SnowflakeConfig
	LoggingConfig     LoggingConfig
	TraceConfig       TraceConfig
	MetricConfig      MetricConfig
	SecureConfig      SecureConfig
	SecureTokenConfig SecureTokenConfig
}

func ExtractSections

func ExtractSections(cfg RootConfig) ExtractSectionsResult

ExtractSections extracts sections from RootConfig. It is used for dependency injection.

type LoggingConfig

type LoggingConfig interface {
	GetZapLogger() LoggingZapLoggerConfig
	GetSlogLogger() LoggingSlogLoggerConfig
}

type LoggingSlogLoggerConfig

type LoggingSlogLoggerConfig interface {
	GetHandler() string
	GetAddSource() bool
	GetLeveler() slog.Leveler
}

type LoggingZapLoggerConfig

type LoggingZapLoggerConfig interface {
	GetPreset() string
}

type MetricConfig

type MetricConfig interface {
	GetExporterConfig() MetricExporterConfig
}

type MetricExporterConfig

type MetricExporterConfig interface {
	GetProtocol() string
	GetEndpoint() string
	GetInsecure() bool
}

type RootConfig

type RootConfig interface {
	GetServerConfig() ServerConfig
	GetSnowflakeConfig() SnowflakeConfig
	GetLoggingConfig() LoggingConfig
	GetTraceConfig() TraceConfig
	GetMetricConfig() MetricConfig
	GetSecureConfig() SecureConfig
}

func LoadYamlConfig

func LoadYamlConfig() (RootConfig, error)

LoadYamlConfig loads RootConfig from file. The path of the file is specified by environment variable GOMMERCE_CONFIG_PATH, If the environment variable is not set, it defaults to "./config/app-deploy.yaml".

type SecureConfig

type SecureConfig interface {
	GetToken() SecureTokenConfig
}

type SecureTokenConfig

type SecureTokenConfig interface {
	GetStore() string
	GetBucket() string
	GetAccessTokenTTL() time.Duration
	GetRefreshTokenTTL() time.Duration
	GetIssuer() string
	GetAudience() string
	GetSigningMethod() string
	GetPublicKey() []byte
	GetPrivateKey() []byte
}

type ServerConfig

type ServerConfig interface {
	GetDebug() bool
	GetName() string
	GetVersion() string
	GetInstanceId() string
	GetHTTPConfig() ServerHTTPConfig
	GetDBConfig() ServerDBConfig
	GetRedisConfig() ServerRedisConfig
	GetMinIOConfig() ServerMinIOConfig
	GetNATSConfig() ServerNATSConfig
}

type ServerDBConfig

type ServerDBConfig interface {
	GetDriver() string
	GetSource() string
}

type ServerHTTPConfig

type ServerHTTPConfig interface {
	GetAddr() string
	GetCors() cors.Options
}

type ServerMinIOConfig

type ServerMinIOConfig interface {
	GetEndpoint() string
	GetAccessKey() string
	GetSecretKey() string
	GetUseSSL() bool
}

type ServerNATSConfig

type ServerNATSConfig interface {
	GetSeedURL() string
	GetNoEcho() bool
}

type ServerRedisConfig

type ServerRedisConfig interface {
	GetInitAddr() string
	GetSelectDB() int
}

type SnowflakeConfig

type SnowflakeConfig interface {
	GetIdEpoch() int64
	GetClusterId() int64
	GetWorkerId() int64
	GetWorkerSeqKey() string
	GetClusterIdBits() int32
	GetWorkerIdBits() int32
	GetSequenceBits() int32
}

type TraceConfig

type TraceConfig interface {
	GetExporterConfig() TraceExporterConfig
}

type TraceExporterConfig

type TraceExporterConfig interface {
	GetProtocol() string
	GetEndpoint() string
	GetInsecure() bool
}

Jump to

Keyboard shortcuts

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