config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfiguration

func InitConfiguration(configName string, configPaths []string, config interface{}) error

InitConfiguration initializes the configuration by first attempting to read from environment variables, and then falling back to configuration files if the environment variables are not set.

Types

type LoggerConfig

type LoggerConfig struct {
	Filename string
	MaxSize  int // MB
}

LoggerConfig configuration for logger

type MetricsConfig

type MetricsConfig struct {
	HTTPEndpoint      string
	User              string
	Password          string
	MaxSamplesPerSend string
}

type MySQLConfiguration

type MySQLConfiguration struct {
	Host     string
	Port     int
	User     string
	Password string
	DBName   string
	LogMode  MySQLLogMode
	Charset  string
}

MySQLConfiguration configuration for MySQL database connection

type MySQLLogMode

type MySQLLogMode string

MySQLLogMode ...

const (
	Console   MySQLLogMode = "console"
	SlowQuery MySQLLogMode = "slow_query"
	None      MySQLLogMode = "none"
)

Console 使用 gorm 的 logger,打印漂亮的sql到控制台 SlowQuery 使用自定义 logger.Logger,记录慢查询sql到日志 None 关闭 logs 功能

type OpenTelemetryConfig

type OpenTelemetryConfig struct {
	Traces OpenTelemetryTracesConfig
	Logs   OpenTelemetryLogsConfig
}

type OpenTelemetryLogsConfig

type OpenTelemetryLogsConfig struct {
	HTTPEndpoint string
	User         string
	Password     string

	File string // log file path
}

type OpenTelemetryTracesConfig

type OpenTelemetryTracesConfig struct {
	HTTPEndpoint  string
	Path          string
	Authorization string
	ServerName    string
}

type PostgresConfiguration

type PostgresConfiguration struct {
	Host     string
	Port     int
	User     string
	Password string
	DBName   string
	SSLMode  bool
	TimeZone string
	LogMode  MySQLLogMode
}

PostgresConfiguration configuration for Postgres database connection

type RedisConfiguration

type RedisConfiguration struct {
	Addr     string
	Db       int
	Password string
}

RedisConfiguration ...

type ServiceConfiguration

type ServiceConfiguration struct {
	Port  string
	Debug bool
}

ServiceConfiguration configuration for service

Jump to

Keyboard shortcuts

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