config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUTH_NONE_EXPIRE_TOKEN             = "AUTH_NONE_EXPIRE_TOKEN"
	AUTH_NONE_EXPIRE_USERNAME          = "AUTH_NONE_EXPIRE_USERNAME"
	AUTH_NONE_EXPIRE_PASSWORD          = "AUTH_NONE_EXPIRE_PASSORD"
	AUTH_BASE_AUTH_USERNAME            = "AUTH_BASE_AUTH_USERNAME"
	AUTH_BASE_AUTH_PASSWORD            = "AUTH_BASE_AUTH_PASSWORD"
	AUTH_ACCESS_TOKEN_EXPIRE_DURATION  = "AUTH_ACCESS_TOKEN_EXPIRE_DURATION"
	AUTH_REFRESH_TOKEN_EXPIRE_DURATION = "AUTH_REFRESH_TOKEN_EXPIRE_DURATION"
)
View Source
const (
	CASSANDRA_HOSTS              = "CASSANDRA_HOSTS"
	CASSANDRA_PORT               = "CASSANDRA_PORT"
	CASSANDRA_KEYSPACE           = "CASSANDRA_KEYSPACE"
	CASSANDRA_USERNAME           = "CASSANDRA_USERNAME"
	CASSANDRA_PASSWORD           = "CASSANDRA_PASSWORD"
	CASSANDRA_CONSISTENCY        = "CASSANDRA_CONSISTENCY"
	CASSANDRA_TIMEOUT            = "CASSANDRA_TIMEOUT"
	CASSANDRA_CONNECT_TIMEOUT    = "CASSANDRA_CONNECT_TIMEOUT"
	CASSANDRA_NUM_CONNS          = "CASSANDRA_NUM_CONNS"
	CASSANDRA_PAGE_SIZE          = "CASSANDRA_PAGE_SIZE"
	CASSANDRA_RETRY_POLICY       = "CASSANDRA_RETRY_POLICY"
	CASSANDRA_RECONNECT_INTERVAL = "CASSANDRA_RECONNECT_INTERVAL"
	CASSANDRA_MAX_RETRY_COUNT    = "CASSANDRA_MAX_RETRY_COUNT"

	CASSANDRA_ENABLE_TLS           = "CASSANDRA_ENABLE_TLS"
	CASSANDRA_CERT_FILE            = "CASSANDRA_CERT_FILE"
	CASSANDRA_KEY_FILE             = "CASSANDRA_KEY_FILE"
	CASSANDRA_CA_FILE              = "CASSANDRA_CA_FILE"
	CASSANDRA_INSECURE_SKIP_VERIFY = "CASSANDRA_INSECURE_SKIP_VERIFY"

	CASSANDRA_ENABLE = "CASSANDRA_ENABLE"
)
View Source
const (
	CLICKHOUSE_HOST          = "CLICKHOUSE_HOST"
	CLICKHOUSE_PORT          = "CLICKHOUSE_PORT"
	CLICKHOUSE_DATABASE      = "CLICKHOUSE_DATABASE"
	CLICKHOUSE_USERNAME      = "CLICKHOUSE_USERNAME"
	CLICKHOUSE_PASSWORD      = "CLICKHOUSE_PASSWORD"
	CLICKHOUSE_DIAL_TIMEOUT  = "CLICKHOUSE_DIAL_TIMEOUT"
	CLICKHOUSE_READ_TIMEOUT  = "CLICKHOUSE_READ_TIMEOUT"
	CLICKHOUSE_WRITE_TIMEOUT = "CLICKHOUSE_WRITE_TIMEOUT"
	CLICKHOUSE_COMPRESS      = "CLICKHOUSE_COMPRESS"
	CLICKHOUSE_DEBUG         = "CLICKHOUSE_DEBUG"
	CLICKHOUSE_ENABLE        = "CLICKHOUSE_ENABLE"
)
View Source
const (
	ModeProd = "prod"
	ModeStg  = "stg"
	ModeDev  = "dev"
)
View Source
const (
	DBSqlite     = "sqlite"
	DBPostgre    = "postgres"
	DBMySQL      = "mysql"
	DBSQLServer  = "sqlserver"
	DBClickHouse = "clickhouse"
)
View Source
const (
	DATABASE_SLOW_QUERY_THRESHOLD = "DATABASE_SLOW_QUERY_THRESHOLD"
	DATABASE_MAX_IDLE_CONNS       = "DATABASE_MAX_IDLE_CONNS"
	DATABASE_MAX_OPEN_CONNS       = "DATABASE_MAX_OPEN_CONNS"
	DATABASE_CONN_MAX_LIFETIME    = "DATABASE_CONN_MAX_LIFETIME"
	DATABASE_CONN_MAX_IDLE_TIME   = "DATABASE_CONN_MAX_IDLE_TIME"
)
View Source
const (
	DEBUG_STATSVIZ_ENABLE = "DEBUG_STATSVIZ_ENABLE"
	DEBUG_STATSVIZ_LISTEN = "DEBUG_STATSVIZ_LISTEN"
	DEBUG_STATSVIZ_PORT   = "DEBUG_STATSVIZ_PORT"

	DEBUG_PPROF_ENABLE = "DEBUG_PPROF_ENABLE"
	DEBUG_PPROF_LISTEN = "DEBUG_PPROF_LISTEN"
	DEBUG_PPROF_PORT   = "DEBUG_PPROF_PORT"

	DEBUG_GOPS_ENABLE = "DEBUG_GOPS_ENABLE"
	DEBUG_GOPS_LISTEN = "DEBUG_GOPS_LISTEN"
	DEBUG_GOPS_PORT   = "DEBUG_GOPS_PORT"
)
View Source
const (
	ELASTICSEARCH_ADDRS                   = "ELASTICSEARCH_ADDRS"
	ELASTICSEARCH_USERNAME                = "ELASTICSEARCH_USERNAME"
	ELASTICSEARCH_PASSWORD                = "ELASTICSEARCH_PASSWORD"
	ELASTICSEARCH_CLOUD_ID                = "ELASTICSEARCH_CLOUD_ID"
	ELASTICSEARCH_API_KEY                 = "ELASTICSEARCH_API_KEY"
	ELASTICSEARCH_MAX_RETRIES             = "ELASTICSEARCH_MAX_RETRIES"
	ELASTICSEARCH_RETRY_ON_STATUS         = "ELASTICSEARCH_RETRY_ON_STATUS"
	ELASTICSEARCH_DISABLE_RETRIES         = "ELASTICSEARCH_DISABLE_RETRIES"
	ELASTICSEARCH_RETRY_BACKOFF           = "ELASTICSEARCH_RETRY_BACKOFF"
	ELASTICSEARCH_RETRY_BACKOFF_MIN       = "ELASTICSEARCH_RETRY_BACKOFF_MIN"
	ELASTICSEARCH_RETRY_BACKOFF_MAX       = "ELASTICSEARCH_RETRY_BACKOFF_MAX"
	ELASTICSEARCH_COMPRESS                = "ELASTICSEARCH_COMPRESS"
	ELASTICSEARCH_DISCOVERY_INTERVAL      = "ELASTICSEARCH_DISCOVERY_INTERVAL"
	ELASTICSEARCH_ENABLE_METRICS          = "ELASTICSEARCH_ENABLE_METRICS"
	ELASTICSEARCH_ENABLE_DEBUG_LOGGER     = "ELASTICSEARCH_ENABLE_DEBUG_LOGGER"
	ELASTICSEARCH_CONNECTION_POOL_SIZE    = "ELASTICSEARCH_CONNECTION_POOL_SIZE"
	ELASTICSEARCH_RESPONSE_HEADER_TIMEOUT = "ELASTICSEARCH_RESPONSE_HEADER_TIMEOUT"
	ELASTICSEARCH_REQUEST_TIMEOUT         = "ELASTICSEARCH_REQUEST_TIMEOUT"
	ELASTICSEARCH_DIAL_TIMEOUT            = "ELASTICSEARCH_DIAL_TIMEOUT"
	ELASTICSEARCH_KEEP_ALIVE_INTERVAL     = "ELASTICSEARCH_KEEP_ALIVE_INTERVAL"

	ELASTICSEARCH_ENABLE_TLS           = "ELASTICSEARCH_ENABLE_TLS"
	ELASTICSEARCH_CERT_FILE            = "ELASTICSEARCH_CERT_FILE"
	ELASTICSEARCH_KEY_FILE             = "ELASTICSEARCH_KEY_FILE"
	ELASTICSEARCH_CA_FILE              = "ELASTICSEARCH_CA_FILE"
	ELASTICSEARCH_INSECURE_SKIP_VERIFY = "ELASTICSEARCH_INSECURE_SKIP_VERIFY"

	ELASTICSEARCH_ENABLE = "ELASTICSEARCH_ENABLE"
)
View Source
const (
	ETCD_ENDPOINTS              = "ETCD_ENDPOINTS"
	ETCD_DIAL_TIMEOUT           = "ETCD_DIAL_TIMEOUT"
	ETCD_USERNAME               = "ETCD_USERNAME"
	ETCD_PASSWORD               = "ETCD_PASSWORD"
	ETCD_AUTO_SYNC              = "ETCD_AUTO_SYNC"
	ETCD_AUTO_SYNC_INTERVAL     = "ETCD_AUTO_SYNC_INTERVAL"
	ETCD_KEEPALIVE_TIME         = "ETCD_KEEPALIVE_TIME"
	ETCD_KEEPALIVE_TIMEOUT      = "ETCD_KEEPALIVE_TIMEOUT"
	ETCD_MAX_CALL_SEND_MSG_SIZE = "ETCD_MAX_CALL_SEND_MSG_SIZE"
	ETCD_MAX_CALL_RECV_MSG_SIZE = "ETCD_MAX_CALL_RECV_MSG_SIZE"
	ETCD_PERMIT_WITHOUT_STREAM  = "ETCD_PERMIT_WITHOUT_STREAM"
	ETCD_REJECT_OLD_CLUSTER     = "ETCD_REJECT_OLD_CLUSTER"

	ETCD_ENABLE_TLS           = "ETCD_ENABLE_TLS"
	ETCD_CERT_FILE            = "ETCD_CERT_FILE"
	ETCD_KEY_FILE             = "ETCD_KEY_FILE"
	ETCD_CA_FILE              = "ETCD_CA_FILE"
	ETCD_INSECURE_SKIP_VERIFY = "ETCD_INSECURE_SKIP_VERIFY"

	ETCD_ENABLE = "ETCD_ENABLE"
)
View Source
const (
	FEISHU_APP_ID     = "FEISHU_APP_ID"
	FEISHU_APP_SECRET = "FEISHU_APP_SECRET"
	FEISHU_APP_TYPE   = "FEISHU_APP_TYPE"

	FEISHU_DISABLE_TOKEN_CACHE = "FEISHU_DISABLE_TOKEN_CACHE"
	FEISHU_REQUEST_TIMEOUT     = "FEISHU_REQUEST_TIMEOUT"

	FEISHU_ENABLE_TLS           = "FEISHU_ENABLE_TLS"
	FEISHU_CERT_FILE            = "FEISHU_CERT_FILE"
	FEISHU_KEY_FILE             = "FEISHU_KEY_FILE"
	FEISHU_CA_FILE              = "FEISHU_CA_FILE"
	FEISHU_INSECURE_SKIP_VERIFY = "FEISHU_INSECURE_SKIP_VERIFY"

	FEISHU_ENABLE = "FEISHU_ENABLE"
)
View Source
const (
	GRPC_LISTEN                   = "GRPC_LISTEN"
	GRPC_PORT                     = "GRPC_PORT"
	GRPC_MAX_RECV_MSG_SIZE        = "GRPC_MAX_RECV_MSG_SIZE"
	GRPC_MAX_SEND_MSG_SIZE        = "GRPC_MAX_SEND_MSG_SIZE"
	GRPC_INITIAL_WINDOW_SIZE      = "GRPC_INITIAL_WINDOW_SIZE"
	GRPC_INITIAL_CONN_WINDOW_SIZE = "GRPC_INITIAL_CONN_WINDOW_SIZE"

	GRPC_KEEPALIVE_TIME           = "GRPC_KEEPALIVE_TIME"
	GRPC_KEEPALIVE_TIMEOUT        = "GRPC_KEEPALIVE_TIMEOUT"
	GRPC_MAX_CONNECTION_IDLE      = "GRPC_MAX_CONNECTION_IDLE"
	GRPC_MAX_CONNECTION_AGE       = "GRPC_MAX_CONNECTION_AGE"
	GRPC_MAX_CONNECTION_AGE_GRACE = "GRPC_MAX_CONNECTION_AGE_GRACE"

	GRPC_ENABLE_TLS          = "GRPC_ENABLE_TLS"
	GRPC_CERT_FILE           = "GRPC_CERT_FILE"
	GRPC_KEY_FILE            = "GRPC_KEY_FILE"
	GRPC_CA_FILE             = "GRPC_CA_FILE"
	GRPC_ENABLE_REFLECTION   = "GRPC_ENABLE_REFLECTION"
	GRPC_ENABLE_HEALTH_CHECK = "GRPC_ENABLE_HEALTH_CHECK"

	GRPC_ENABLE = "GRPC_ENABLE"
)
View Source
const (
	INFLUXDB_HOST   = "INFLUXDB_HOST"
	INFLUXDB_PORT   = "INFLUXDB_PORT"
	INFLUXDB_TOKEN  = "INFLUXDB_TOKEN"
	INFLUXDB_ORG    = "INFLUXDB_ORG"
	INFLUXDB_BUCKET = "INFLUXDB_BUCKET"

	INFLUXDB_BATCH_SIZE         = "INFLUXDB_BATCH_SIZE"
	INFLUXDB_FLUSH_INTERVAL     = "INFLUXDB_FLUSH_INTERVAL"
	INFLUXDB_RETRY_INTERVAL     = "INFLUXDB_RETRY_INTERVAL"
	INFLUXDB_MAX_RETRIES        = "INFLUXDB_MAX_RETRIES"
	INFLUXDB_RETRY_BUFFER_LIMIT = "INFLUXDB_RETRY_BUFFER_LIMIT"
	INFLUXDB_MAX_RETRY_INTERVAL = "INFLUXDB_MAX_RETRY_INTERVAL"
	INFLUXDB_MAX_RETRY_TIME     = "INFLUXDB_MAX_RETRY_TIME"
	INFLUXDB_EXPONENTIAL_BASE   = "INFLUXDB_EXPONENTIAL_BASE"
	INFLUXDB_PRECISION          = "INFLUXDB_PRECISION"
	INFLUXDB_USE_GZIP           = "INFLUXDB_USE_GZIP"

	INFLUXDB_ENABLE_TLS           = "INFLUXDB_ENABLE_TLS"
	INFLUXDB_CERT_FILE            = "INFLUXDB_CERT_FILE"
	INFLUXDB_KEY_FILE             = "INFLUXDB_KEY_FILE"
	INFLUXDB_CA_FILE              = "INFLUXDB_CA_FILE"
	INFLUXDB_INSECURE_SKIP_VERIFY = "INFLUXDB_INSECURE_SKIP_VERIFY"

	INFLUXDB_DEFAULT_TAGS = "INFLUXDB_DEFAULT_TAGS" // format:key1=value1,key2=value2
	INFLUXDB_APP_NAME     = "INFLUXDB_APP_NAME"

	INFLUXDB_ENABLE = "INFLUXDB_ENABLE"
)
View Source
const (
	KAFKA_BROKERS   = "KAFKA_BROKERS"
	KAFKA_CLIENT_ID = "KAFKA_CLIENT_ID"
	KAFKA_VERSION   = "KAFKA_VERSION"

	KAFKA_SASL_ENABLE    = "KAFKA_SASL_ENABLE"
	KAFKA_SASL_MECHANISM = "KAFKA_SASL_MECHANISM"
	KAFKA_SASL_USERNAME  = "KAFKA_SASL_USERNAME"
	KAFKA_SASL_PASSWORD  = "KAFKA_SASL_PASSWORD"

	KAFKA_ENABLE_TLS           = "KAFKA_ENABLE_TLS"
	KAFKA_CERT_FILE            = "KAFKA_CERT_FILE"
	KAFKA_KEY_FILE             = "KAFKA_KEY_FILE"
	KAFKA_CA_FILE              = "KAFKA_CA_FILE"
	KAFKA_INSECURE_SKIP_VERIFY = "KAFKA_INSECURE_SKIP_VERIFY"

	KAFKA_PRODUCER_REQUIRED_ACKS     = "KAFKA_PRODUCER_REQUIRED_ACKS"
	KAFKA_PRODUCER_RETRIES           = "KAFKA_PRODUCER_RETRIES"
	KAFKA_PRODUCER_COMPRESSION       = "KAFKA_PRODUCER_COMPRESSION"
	KAFKA_PRODUCER_MAX_MESSAGE_BYTES = "KAFKA_PRODUCER_MAX_MESSAGE_BYTES"

	KAFKA_CONSUMER_GROUP              = "KAFKA_CONSUMER_GROUP"
	KAFKA_CONSUMER_REBALANCE_STRATEGY = "KAFKA_CONSUMER_REBALANCE_STRATEGY"
	KAFKA_CONSUMER_OFFSET             = "KAFKA_CONSUMER_OFFSET"

	KAFKA_TIMEOUT_DIAL  = "KAFKA_TIMEOUT_DIAL"
	KAFKA_TIMEOUT_READ  = "KAFKA_TIMEOUT_READ"
	KAFKA_TIMEOUT_WRITE = "KAFKA_TIMEOUT_WRITE"

	KAFKA_ENABLE = "KAFKA_ENABLE"
)
View Source
const (
	LDAP_HOST            = "LDAP_HOST"
	LDAP_PORT            = "LDAP_PORT"
	LDAP_BASE_DN         = "LDAP_BASE_DN"
	LDAP_BIND_DN         = "LDAP_BIND_DN"
	LDAP_BIND_PASSWORD   = "LDAP_BIND_PASSWORD"
	LDAP_ATTRIBUTES      = "LDAP_ATTRIBUTES"
	LDAP_FILTER          = "LDAP_FILTER"
	LDAP_GROUP_FILTER    = "LDAP_GROUP_FILTER"
	LDAP_USER_FILTER     = "LDAP_USER_FILTER"
	LDAP_GROUP_DN        = "LDAP_GROUP_DN"
	LDAP_USER_DN         = "LDAP_USER_DN"
	LDAP_GROUP_ATTRIBUTE = "LDAP_GROUP_ATTRIBUTE"
	LDAP_USER_ATTRIBUTE  = "LDAP_USER_ATTRIBUTE"
	LDAP_SCOPE           = "LDAP_SCOPE"
	LDAP_REQUEST_TIMEOUT = "LDAP_REQUEST_TIMEOUT"
	LDAP_CONN_TIMEOUT    = "LDAP_CONN_TIMEOUT"
	LDAP_REFERRALS       = "LDAP_REFERRALS"
	LDAP_DEREF           = "LDAP_DEREF"
	LDAP_PAGE_SIZE       = "LDAP_PAGE_SIZE"
	LDAP_HEARTBEAT       = "LDAP_HEARTBEAT"

	LDAP_ENABLE_TLS           = "LDAP_ENABLE_TLS"
	LDAP_CERT_FILE            = "LDAP_CERT_FILE"
	LDAP_KEY_FILE             = "LDAP_KEY_FILE"
	LDAP_CA_FILE              = "LDAP_CA_FILE"
	LDAP_INSECURE_SKIP_VERIFY = "LDAP_INSECURE_SKIP_VERIFY"

	LDAP_ENABLE = "LDAP_ENABLE"
)
View Source
const (
	LOGGER_DIR         = "LOGGER_DIR"
	LOGGER_PREFIX      = "LOGGER_PREFIX"
	LOGGER_FILE        = "LOGGER_FILE"
	LOGGER_LEVEL       = "LOGGER_LEVEL"
	LOGGER_FORMAT      = "LOGGER_FORMAT"
	LOGGER_ENCODER     = "LOGGER_ENCODER"
	LOGGER_MAX_AGE     = "LOGGER_MAX_AGE"
	LOGGER_MAX_SIZE    = "LOGGER_MAX_SIZE"
	LOGGER_MAX_BACKUPS = "LOGGER_MAX_BACKUPS"
)
View Source
const (
	MINIO_ENDPOINT      = "MINIO_ENDPOINT"
	MINIO_ACCESS_KEY    = "MINIO_ACCESS_KEY"
	MINIO_SECRET_KEY    = "MINIO_SECRET_KEY"
	MINIO_BUCKET        = "MINIO_BUCKET"
	MINIO_LOCATION      = "MINIO_LOCATION"
	MINIO_SECURE        = "MINIO_SECURE"
	MINIO_REGION        = "MINIO_REGION"
	MINIO_TIMEOUT       = "MINIO_TIMEOUT"
	MINIO_PART_SIZE     = "MINIO_PART_SIZE"
	MINIO_CONCURRENCY   = "MINIO_CONCURRENCY"
	MINIO_COMPRESS      = "MINIO_COMPRESS"
	MINIO_TRACE         = "MINIO_TRACE"
	MINIO_SESSION_TOKEN = "MINIO_SESSION_TOKEN"
	MINIO_USE_IAM       = "MINIO_USE_IAM"
	MINIO_USE_STS       = "MINIO_USE_STS"
	MINIO_IAM_ENDPOINT  = "MINIO_IAM_ENDPOINT"
	MINIO_STS_ENDPOINT  = "MINIO_STS_ENDPOINT"

	MINIO_ENABLE_TLS           = "MINIO_ENABLE_TLS"
	MINIO_CERT_FILE            = "MINIO_CERT_FILE"
	MINIO_KEY_FILE             = "MINIO_KEY_FILE"
	MINIO_CA_FILE              = "MINIO_CA_FILE"
	MINIO_INSECURE_SKIP_VERIFY = "MINIO_INSECURE_SKIP_VERIFY"

	MINIO_ENABLE = "MINIO_ENABLE"
)
View Source
const (
	MONGO_HOST          = "MONGO_HOST"
	MONGO_PORT          = "MONGO_PORT"
	MONGO_USERNAME      = "MONGO_USERNAME"
	MONGO_PASSWORD      = "MONGO_PASSWORD"
	MONGO_DATABASE      = "MONGO_DATABASE"
	MONGO_AUTH_SOURCE   = "MONGO_AUTH_SOURCE"
	MONGO_MAX_POOL_SIZE = "MONGO_MAX_POOL_SIZE"
	MONGO_MIN_POOL_SIZE = "MONGO_MIN_POOL_SIZE"

	MONGO_CONNECT_TIMEOUT          = "MONGO_CONNECT_TIMEOUT"
	MONGO_SERVER_SELECTION_TIMEOUT = "MONGO_SERVER_SELECTION_TIMEOUT"
	MONGO_MAX_CONN_IDLE_TIME       = "MONGO_MAX_CONN_IDLE_TIME"
	MONGO_MAX_CONNECTING           = "MONGO_MAX_CONNECTING"

	MONGO_READ_CONCERN  = "MONGO_READ_CONCERN"
	MONGO_WRITE_CONCERN = "MONGO_WRITE_CONCERN"

	MONGO_ENABLE_TLS           = "MONGO_ENABLE_TLS"
	MONGO_CERT_FILE            = "MONGO_CERT_FILE"
	MONGO_KEY_FILE             = "MONGO_KEY_FILE"
	MONGO_CA_FILE              = "MONGO_CA_FILE"
	MONGO_INSECURE_SKIP_VERIFY = "MONGO_INSECURE_SKIP_VERIFY"

	MONGO_ENABLE = "MONGO_ENABLE"
)
View Source
const (
	MQTT_ADDR                 = "MQTT_ADDR"
	MQTT_USERNAME             = "MQTT_USERNAME"
	MQTT_PASSWORD             = "MQTT_PASSWORD"
	MQTT_CLIENT_PREFIX        = "MQTT_CLIENT_PREFIX"
	MQTT_CONNECT_TIMEOUT      = "MQTT_CONNECT_TIMEOUT"
	MQTT_KEEPALIVE            = "MQTT_KEEPALIVE"
	MQTT_CLEAN_SESSION        = "MQTT_CLEAN_SESSION"
	MQTT_AUTO_RECONNECT       = "MQTT_AUTO_RECONNECT"
	MQTT_USE_TLS              = "MQTT_USE_TLS"
	MQTT_CERT_FILE            = "MQTT_CERT_FILE"
	MQTT_KEY_FILE             = "MQTT_KEY_FILE"
	MQTT_INSECURE_SKIP_VERIFY = "MQTT_INSECURE_SKIP_VERIFY"
	MQTT_ENABLE               = "MQTT_ENABLE"
)
View Source
const (
	MYSQL_HOST     = "MYSQL_HOST"
	MYSQL_PORT     = "MYSQL_PORT"
	MYSQL_DATABASE = "MYSQL_DATABASE"
	MYSQL_USERNAME = "MYSQL_USERNAME"
	MYSQL_PASSWORD = "MYSQL_PASSWORD"
	MYSQL_CHARSET  = "MYSQL_CHARSET"
	MYSQL_ENABLE   = "MYSQL_ENABLE"
)
View Source
const (
	NATS_ADDRS       = "NATS_ADDRS"
	NATS_CLIENT_NAME = "NATS_CLIENT_NAME"
	NATS_USERNAME    = "NATS_USERNAME"
	NATS_PASSWORD    = "NATS_PASSWORD"
	NATS_TOKEN       = "NATS_TOKEN"
	NATS_CREDENTIALS = "NATS_CREDENTIALS"
	NATS_NKEY_FILE   = "NATS_NKEY_FILE"

	NATS_MAX_RECONNECTS       = "NATS_MAX_RECONNECTS"
	NATS_RECONNECT_WAIT       = "NATS_RECONNECT_WAIT"
	NATS_RECONNECT_JITTER     = "NATS_RECONNECT_JITTER"
	NATS_RECONNECT_JITTER_TLS = "NATS_RECONNECT_JITTER_TLS"

	NATS_CONNECT_TIMEOUT       = "NATS_CONNECT_TIMEOUT"
	NATS_PING_INTERVAL         = "NATS_PING_INTERVAL"
	NATS_MAX_PINGS_OUTSTANDING = "NATS_MAX_PINGS_OUTSTANDING"

	NATS_ENABLE_TLS           = "NATS_ENABLE_TLS"
	NATS_CERT_FILE            = "NATS_CERT_FILE"
	NATS_KEY_FILE             = "NATS_KEY_FILE"
	NATS_CA_FILE              = "NATS_CA_FILE"
	NATS_INSECURE_SKIP_VERIFY = "NATS_INSECURE_SKIP_VERIFY"

	NATS_ENABLE = "NATS_ENABLE"
)
View Source
const (
	POSTGRES_HOST     = "POSTGRES_HOST"
	POSTGRES_PORT     = "POSTGRES_PORT"
	POSTGRES_DATABASE = "POSTGRES_DATABASE"
	POSTGRES_USERNAME = "POSTGRES_USERNAME"
	POSTGRES_PASSWORD = "POSTGRES_PASSWORD"
	POSTGRES_SSLMODE  = "POSTGRES_SSLMODE"
	POSTGRES_TIMEZONE = "POSTGRES_TIMEZONE"
	POSTGRES_ENABLE   = "POSTGRES_ENABLE"
)
View Source
const (
	REDIS_ADDR         = "REDIS_ADDR"
	REDIS_ADDRS        = "REDIS_ADDRS"
	REDIS_DB           = "REDIS_DB"
	REDIS_PASSWORD     = "REDIS_PASSWORD"
	REDIS_NAMESPACE    = "REDIS_NAMESPACE"
	REDIS_POOL_SIZE    = "REDIS_POOL_SIZE"
	REDIS_EXPIRATION   = "REDIS_EXPIRATION"
	REDIS_CLUSTER_MODE = "REDIS_CLUSTER_MODE"

	REDIS_DIAL_TIMEOUT      = "REDIS_DIAL_TIMEOUT"
	REDIS_READ_TIMEOUT      = "REDIS_READ_TIMEOUT"
	REDIS_WRITE_TIMEOUT     = "REDIS_WRITE_TIMEOUT"
	REDIS_MIN_IDLE_CONNS    = "REDIS_MIN_IDLE_CONNS"
	REDIS_MAX_RETRIES       = "REDIS_MAX_RETRIES"
	REDIS_MIN_RETRY_BACKOFF = "REDIS_MIN_RETRY_BACKOFF"
	REDIS_MAX_RETRY_BACKOFF = "REDIS_MAX_RETRY_BACKOFF"

	REDIS_ENABLE_TLS           = "REDIS_ENABLE_TLS"
	REDIS_CERT_FILE            = "REDIS_CERT_FILE"
	REDIS_KEY_FILE             = "REDIS_KEY_FILE"
	REDIS_CA_FILE              = "REDIS_CA_FILE"
	REDIS_INSECURE_SKIP_VERIFY = "REDIS_INSECURE_SKIP_VERIFY"

	REDIS_ENABLE = "REDIS_ENABLE"
)
View Source
const (
	S3_ENDPOINT          = "S3_ENDPOINT"
	S3_REGION            = "S3_REGION"
	S3_ACCESS_KEY_ID     = "S3_ACCESS_KEY_ID"
	S3_SECRET_ACCESS_KEY = "S3_SECRET_ACCESS_KEY"
	S3_BUCKET            = "S3_BUCKET"
	S3_USE_SSL           = "S3_USE_SSL"
	S3_ENABLE            = "S3_ENABLE"
)
View Source
const (
	SERVER_DOMAIN      = "SERVER_DOMAIN"
	SERVER_MODE        = "SERVER_MODE"
	SERVER_LISTEN      = "SERVER_LISTEN"
	SERVER_PORT        = "SERVER_PORT"
	SERVER_DB          = "SERVER_DB"
	SERVER_ENABLE_RBAC = "SERVER_ENABLE_RBAC"

	// Circuit breaker related environment variables
	SERVER_CIRCUIT_BREAKER_NAME         = "SERVER_CIRCUIT_BREAKER_NAME"
	SERVER_CIRCUIT_BREAKER_MAX_REQUESTS = "SERVER_CIRCUIT_BREAKER_MAX_REQUESTS"
	SERVER_CIRCUIT_BREAKER_INTERVAL     = "SERVER_CIRCUIT_BREAKER_INTERVAL"
	SERVER_CIRCUIT_BREAKER_TIMEOUT      = "SERVER_CIRCUIT_BREAKER_TIMEOUT"
	SERVER_CIRCUIT_BREAKER_FAILURE_RATE = "SERVER_CIRCUIT_BREAKER_FAILURE_RATE"
	SERVER_CIRCUIT_BREAKER_MIN_REQUESTS = "SERVER_CIRCUIT_BREAKER_MIN_REQUESTS"
	SERVER_CIRCUIT_BREAKER_ENABLE       = "SERVER_CIRCUIT_BREAKER_ENABLE"
)
View Source
const (
	SQLITE_PATH      = "SQLITE_PATH"
	SQLITE_DATABASE  = "SQLITE_DATABASE"
	SQLITE_IS_MEMORY = "SQLITE_IS_MEMORY"
	SQLITE_ENABLE    = "SQLITE_ENABLE"
)
View Source
const (
	SQLSERVER_HOST         = "SQLSERVER_HOST"
	SQLSERVER_PORT         = "SQLSERVER_PORT"
	SQLSERVER_DATABASE     = "SQLSERVER_DATABASE"
	SQLSERVER_USERNAME     = "SQLSERVER_USERNAME"
	SQLSERVER_PASSWORD     = "SQLSERVER_PASSWORD"
	SQLSERVER_ENCRYPT      = "SQLSERVER_ENCRYPT"
	SQLSERVER_TRUST_SERVER = "SQLSERVER_TRUST_SERVER"
	SQLSERVER_APP_NAME     = "SQLSERVER_APP_NAME"
	SQLSERVER_ENABLE       = "SQLSERVER_ENABLE"
)
View Source
const (
	APP_NAME = "golib"
)

Variables

View Source
var (
	App = new(Config)
)

Functions

func AddPath

func AddPath(paths ...string)

AddPath add custom config path. default: ./config, /etc You should always call this funtion before `Init`.

func Clean added in v0.4.1

func Clean()

func Get added in v0.3.3

func Get[T any](name string) (t T)

Get returns the registered configuration by name. The type parameter T must match the registered type or be a pointer to it, othherwise a zero value or nil pointer will be returned.

Example usage:

config.Register[WechatConfig]("wechat")

// Get by value type - returns value
cfg1 := config.Get[WechatConfig]("wechat")

// Get by pointer type - returns pointer
cfg2 := config.Get[*WechatConfig]("wechat")

// Type mismatch - returns zero value
cfg3 := config.Get[OtherConfig]("wechat")

// Type mismatch - returns nil
cfg4 := config.Get[*OtherConfig]("wechat")

func Init

func Init() (err error)

Init initializes the application configuration

Configuration priority (from highest to lowest): 1. Environment variables 2. Configuration file 3. Default values

func Register added in v0.3.3

func Register[T any](name string)

Register registers a configuration type with the given name. The type parameter T can be either struct type or pointer to struct type. The registered type will be used to create and initialize the configuration instance when loading configuration from file or environment variables.

Configuration values are loaded in the following priority order (from highest to lowest): 1. Environment variables (format: SECTION_FIELD, e.g., NATS_USERNAME) 2. Configuration file values 3. Default values from struct tags

The struct tag "default" can be used to set default values for fields. For time.Duration fields, you can use duration strings like "5s", "1m", etc.

Register can be called before or after `Init`. If called before `Init`, the registration will be processed during initialization.

Example usage:

type WechatConfig struct {
	AppID     string `json:"app_id" mapstructure:"app_id" default:"myappid"`
	AppSecret string `json:"app_secret" mapstructure:"app_secret" default:"myappsecret"`
	Enable    bool   `json:"enable" mapstructure:"enable"`
}

type NatsConfig struct {
	URL      string        `json:"url" mapstructure:"url" default:"nats://127.0.0.1:4222"`
	Username string        `json:"username" mapstructure:"username" default:"nats"`
	Password string        `json:"password" mapstructure:"password" default:"nats"`
	Timeout  time.Duration `json:"timeout" mapstructure:"timeout" default:"5s"`
	Enable   bool          `json:"enable" mapstructure:"enable"`
}

// Register with struct type
config.Register[WechatConfig]("wechat")

// Register with pointer type (equivalent to above)
config.Register[*NatsConfig]("nats")

After registration, you can access the config using Get:

natsCfg := config.Get[NatsConfig]("nats")
// or with pointer
natsPtr := config.Get[*NatsConfig]("nats")

func Save

func Save(filename string) error

Save config instance to file.

func SetConfigFile

func SetConfigFile(file string)

SetConfigFile set the config file path. You should always call this funtion before `Init`.

func SetConfigName

func SetConfigName(name string)

SetConfigName set the config file name, default to 'config'. NOTE: any suffix will be ignored and the default file type is ini. You should always call this funtion before `Init`.

func SetConfigType

func SetConfigType(typ string)

SetConfigType set the config file type, default to 'ini'. You should always call this funtion before `Init`.

func Tempdir added in v0.4.1

func Tempdir() string

Types

type Auth added in v0.4.0

type Auth struct {
	NoneExpireToken            string        `json:"none_expire_token" mapstructure:"none_expire_token" ini:"none_expire_token" yaml:"none_expire_token"`
	NoneExpireUsername         string        `json:"none_expire_username" mapstructure:"none_expire_username" ini:"none_expire_username" yaml:"none_expire_username"`
	NoneExpirePassword         string        `json:"none_expire_passord" mapstructure:"none_expire_passord" ini:"none_expire_passord" yaml:"none_expire_passord"`
	BaseAuthUsername           string        `json:"base_auth_username" mapstructure:"base_auth_username" ini:"base_auth_username" yaml:"base_auth_username"`
	BaseAuthPassword           string        `json:"base_auth_password" mapstructure:"base_auth_password" ini:"base_auth_password" yaml:"base_auth_password"`
	AccessTokenExpireDuration  time.Duration `` /* 150-byte string literal not displayed */
	RefreshTokenExpireDuration time.Duration `` /* 154-byte string literal not displayed */
}

type Cassandra added in v0.4.0

type Cassandra struct {
	Hosts    []string `json:"hosts" mapstructure:"hosts" ini:"hosts" yaml:"hosts"`
	Port     int      `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Keyspace string   `json:"keyspace" mapstructure:"keyspace" ini:"keyspace" yaml:"keyspace"`
	Username string   `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password string   `json:"password" mapstructure:"password" ini:"password" yaml:"password"`

	Consistency       string        `json:"consistency" mapstructure:"consistency" ini:"consistency" yaml:"consistency"`
	Timeout           time.Duration `json:"timeout" mapstructure:"timeout" ini:"timeout" yaml:"timeout"`
	ConnectTimeout    time.Duration `json:"connect_timeout" mapstructure:"connect_timeout" ini:"connect_timeout" yaml:"connect_timeout"`
	NumConns          int           `json:"num_conns" mapstructure:"num_conns" ini:"num_conns" yaml:"num_conns"`
	PageSize          int           `json:"page_size" mapstructure:"page_size" ini:"page_size" yaml:"page_size"`
	RetryPolicy       string        `json:"retry_policy" mapstructure:"retry_policy" ini:"retry_policy" yaml:"retry_policy"`
	ReconnectInterval time.Duration `json:"reconnect_interval" mapstructure:"reconnect_interval" ini:"reconnect_interval" yaml:"reconnect_interval"`
	MaxRetryCount     int           `json:"max_retry_count" mapstructure:"max_retry_count" ini:"max_retry_count" yaml:"max_retry_count"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type CircuitBreaker added in v0.4.1

type CircuitBreaker struct {
	Name        string        `json:"name" mapstructure:"name" ini:"name" yaml:"name"`
	MaxRequests uint32        `json:"max_requests" mapstructure:"max_requests" ini:"max_requests" yaml:"max_requests"`
	Interval    time.Duration `json:"interval" mapstructure:"interval" ini:"interval" yaml:"interval"`
	Timeout     time.Duration `json:"timeout" mapstructure:"timeout" ini:"timeout" yaml:"timeout"`
	FailureRate float64       `json:"failure_rate" mapstructure:"failure_rate" ini:"failure_rate" yaml:"failure_rate"`
	MinRequests uint32        `json:"min_requests" mapstructure:"min_requests" ini:"min_requests" yaml:"min_requests"`
	Enable      bool          `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Clickhouse added in v0.4.0

type Clickhouse struct {
	Host         string `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port         uint   `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Database     string `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	Username     string `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password     string `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	DialTimeout  string `json:"dial_timeout" mapstructure:"dial_timeout" ini:"dial_timeout" yaml:"dial_timeout"`
	ReadTimeout  string `json:"read_timeout" mapstructure:"read_timeout" ini:"read_timeout" yaml:"read_timeout"`
	WriteTimeout string `json:"write_timeout" mapstructure:"write_timeout" ini:"write_timeout" yaml:"write_timeout"`
	Compress     bool   `json:"compress" mapstructure:"compress" ini:"compress" yaml:"compress"`
	Debug        bool   `json:"debug" mapstructure:"debug" ini:"debug" yaml:"debug"`
	Enable       bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Config

type Config struct {
	Server        `json:"server" mapstructure:"server" ini:"server" yaml:"server"`
	Grpc          `json:"grpc" mapstructure:"grpc" ini:"grpc" yaml:"grpc"`
	Auth          `json:"auth" mapstructure:"auth" ini:"auth" yaml:"auth"`
	Database      `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	Sqlite        `json:"sqlite" mapstructure:"sqlite" ini:"sqlite" yaml:"sqlite"`
	Postgres      `json:"postgres" mapstructure:"postgres" ini:"postgres" yaml:"postgres"`
	MySQL         `json:"mysql" mapstructure:"mysql" ini:"mysql" yaml:"mysql"`
	SQLServer     `json:"sqlserver" mapstructure:"sqlserver" ini:"sqlserver" yaml:"sqlserver"`
	Clickhouse    `json:"clickhouse" mapstructure:"clickhouse" ini:"clickhouse" yaml:"clickhouse"`
	Redis         `json:"redis" mapstructure:"redis" ini:"redis" yaml:"redis"`
	Elasticsearch `json:"elasticsearch" mapstructure:"elasticsearch" ini:"elasticsearch" yaml:"elasticsearch"`
	Mongo         `json:"mongo" mapstructure:"mongo" ini:"mongo" yaml:"mongo"`
	Kafka         `json:"kafka" mapstructure:"kafka" ini:"kafka" yaml:"kafka"`
	Minio         `json:"minio" mapstructure:"minio" ini:"minio" yaml:"minio"`
	S3            `json:"s3" mapstructure:"s3" ini:"s3" yaml:"s3"`
	Logger        `json:"logger" mapstructure:"logger" ini:"logger" yaml:"logger"`
	Ldap          `json:"ldap" mapstructure:"ldap" ini:"ldap" yaml:"ldap"`
	Influxdb      `json:"influxdb" mapstructure:"influxdb" ini:"influxdb" yaml:"influxdb"`
	Mqtt          `json:"mqtt" mapstructure:"mqtt" ini:"mqtt" yaml:"mqtt"`
	Nats          `json:"nats" mapstructure:"nats" ini:"nats" yaml:"nats"`
	Etcd          `json:"etcd" mapstructure:"etcd" ini:"etcd" yaml:"etcd"`
	Cassandra     `json:"cassandra" mapstructure:"cassandra" ini:"cassandra" yaml:"cassandra"`
	Feishu        `json:"feishu" mapstructure:"feishu" ini:"feishu" yaml:"feishu"`
	Debug         `json:"debug" mapstructure:"debug" ini:"debug" yaml:"debug"`
}

type Consumer added in v0.4.0

type Consumer struct {
	Group             string `json:"group" mapstructure:"group" ini:"group" yaml:"group"`
	RebalanceStrategy string `json:"rebalance_strategy" mapstructure:"rebalance_strategy" ini:"rebalance_strategy" yaml:"rebalance_strategy"`
	Offset            string `json:"offset" mapstructure:"offset" ini:"offset" yaml:"offset"`
}

Consumer defines Kafka consumer specific configuration

type DB added in v0.0.52

type DB string

type Database added in v0.4.0

type Database struct {
	SlowQueryThreshold time.Duration `json:"slow_query_threshold" mapstructure:"slow_query_threshold" ini:"slow_query_threshold" yaml:"slow_query_threshold"`
	MaxIdleConns       int           `json:"max_idle_conns" mapstructure:"max_idle_conns" ini:"max_idle_conns" yaml:"max_idle_conns"`
	MaxOpenConns       int           `json:"max_open_conns" mapstructure:"max_open_conns" ini:"max_open_conns" yaml:"max_open_conns"`
	ConnMaxLifetime    time.Duration `json:"conn_max_lifetime" mapstructure:"conn_max_lifetime" ini:"conn_max_lifetime" yaml:"conn_max_lifetime"`
	ConnMaxIdleTime    time.Duration `json:"conn_max_idle_time" mapstructure:"conn_max_idle_time" ini:"conn_max_idle_time" yaml:"conn_max_idle_time"`
}

type Debug added in v0.4.0

type Debug struct {
	StatsvizEnable bool   `json:"statsviz_enable" mapstructure:"statsviz_enable" ini:"statsviz_enable" yaml:"statsviz_enable"`
	StatsvizListen string `json:"statsviz_listen" mapstructure:"statsviz_listen" ini:"statsviz_listen" yaml:"statsviz_listen"`
	StatsvizPort   int    `json:"statsviz_port" mapstructure:"statsviz_port" ini:"statsviz_port" yaml:"statsviz_port"`

	PprofEnable bool   `json:"pprof_enable" mapstructure:"pprof_enable" ini:"pprof_enable" yaml:"pprof_enable"`
	PprofListen string `json:"pprof_listen" mapstructure:"pprof_listen" ini:"pprof_listen" yaml:"pprof_listen"`
	PprofPort   int    `json:"pprof_port" mapstructure:"pprof_port" ini:"pprof_port" yaml:"pprof_port"`

	GopsEnable bool   `json:"gops_enable" mapstructure:"gops_enable" ini:"gops_enable" yaml:"gops_enable"`
	GopsListen string `json:"gops_listen" mapstructure:"gops_listen" ini:"gops_listen" yaml:"gops_listen"`
	GopsPort   int    `json:"gops_port" mapstructure:"gops_port" ini:"gops_port" yaml:"gops_port"`
}

type DerefAliases added in v0.4.0

type DerefAliases int

DerefAliases controls alias dereferencing

const (
	// NeverDerefAliases never dereferences aliases
	NeverDerefAliases DerefAliases = 0
	// DerefInSearching dereferences aliases in searching
	DerefInSearching DerefAliases = 1
	// DerefFindingBaseObj dereferences aliases in finding the base object
	DerefFindingBaseObj DerefAliases = 2
	// DerefAlways dereferences aliases always
	DerefAlways DerefAliases = 3
)

type Elasticsearch added in v0.4.0

type Elasticsearch struct {
	Addrs                 []string      `json:"addrs" mapstructure:"addrs" ini:"addrs" yaml:"addrs"`
	Username              string        `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password              string        `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	CloudID               string        `json:"cloud_id" mapstructure:"cloud_id" ini:"cloud_id" yaml:"cloud_id"`
	APIKey                string        `json:"api_key" mapstructure:"api_key" ini:"api_key" yaml:"api_key"`
	MaxRetries            int           `json:"max_retries" mapstructure:"max_retries" ini:"max_retries" yaml:"max_retries"`
	RetryOnStatus         []int         `json:"retry_on_status" mapstructure:"retry_on_status" ini:"retry_on_status" yaml:"retry_on_status"`
	DisableRetries        bool          `json:"disable_retries" mapstructure:"disable_retries" ini:"disable_retries" yaml:"disable_retries"`
	RetryBackoff          bool          `json:"retry_backoff" mapstructure:"retry_backoff" ini:"retry_backoff" yaml:"retry_backoff"`
	RetryBackoffMin       time.Duration `json:"retry_backoff_min" mapstructure:"retry_backoff_min" ini:"retry_backoff_min" yaml:"retry_backoff_min"`
	RetryBackoffMax       time.Duration `json:"retry_backoff_max" mapstructure:"retry_backoff_max" ini:"retry_backoff_max" yaml:"retry_backoff_max"`
	Compress              bool          `json:"compress" mapstructure:"compress" ini:"compress" yaml:"compress"`
	DiscoveryInterval     time.Duration `json:"discovery_interval" mapstructure:"discovery_interval" ini:"discovery_interval" yaml:"discovery_interval"`
	EnableMetrics         bool          `json:"enable_metrics" mapstructure:"enable_metrics" ini:"enable_metrics" yaml:"enable_metrics"`
	EnableDebugLogger     bool          `json:"enable_debug_logger" mapstructure:"enable_debug_logger" ini:"enable_debug_logger" yaml:"enable_debug_logger"`
	ConnectionPoolSize    int           `json:"connection_pool_size" mapstructure:"connection_pool_size" ini:"connection_pool_size" yaml:"connection_pool_size"`
	ResponseHeaderTimeout time.Duration `` /* 130-byte string literal not displayed */
	RequestTimeout        time.Duration `json:"request_timeout" mapstructure:"request_timeout" ini:"request_timeout" yaml:"request_timeout"`
	DialTimeout           time.Duration `json:"dial_timeout" mapstructure:"dial_timeout" ini:"dial_timeout" yaml:"dial_timeout"`
	KeepAliveInterval     time.Duration `json:"keep_alive_interval" mapstructure:"keep_alive_interval" ini:"keep_alive_interval" yaml:"keep_alive_interval"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Etcd added in v0.4.0

type Etcd struct {
	Endpoints           []string      `json:"endpoints" mapstructure:"endpoints" ini:"endpoints" yaml:"endpoints"`
	DialTimeout         time.Duration `json:"dial_timeout" mapstructure:"dial_timeout" ini:"dial_timeout" yaml:"dial_timeout"`
	Username            string        `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password            string        `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	AutoSync            bool          `json:"auto_sync" mapstructure:"auto_sync" ini:"auto_sync" yaml:"auto_sync"`
	AutoSyncInterval    time.Duration `json:"auto_sync_interval" mapstructure:"auto_sync_interval" ini:"auto_sync_interval" yaml:"auto_sync_interval"`
	KeepAliveTime       time.Duration `json:"keepalive_time" mapstructure:"keepalive_time" ini:"keepalive_time" yaml:"keepalive_time"`
	KeepAliveTimeout    time.Duration `json:"keepalive_timeout" mapstructure:"keepalive_timeout" ini:"keepalive_timeout" yaml:"keepalive_timeout"`
	MaxCallSendMsgSize  int           `` /* 126-byte string literal not displayed */
	MaxCallRecvMsgSize  int           `` /* 126-byte string literal not displayed */
	PermitWithoutStream bool          `json:"permit_without_stream" mapstructure:"permit_without_stream" ini:"permit_without_stream" yaml:"permit_without_stream"`
	RejectOldCluster    bool          `json:"reject_old_cluster" mapstructure:"reject_old_cluster" ini:"reject_old_cluster" yaml:"reject_old_cluster"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

Etcd 配置结构

type Feishu added in v0.4.0

type Feishu struct {
	AppID     string        `json:"app_id" mapstructure:"app_id" ini:"app_id" yaml:"app_id"`
	AppSecret string        `json:"app_secret" mapstructure:"app_secret" ini:"app_secret" yaml:"app_secret"`
	AppType   FeishuAppType `json:"app_type" mapstructure:"app_type" ini:"app_type" yaml:"app_type"`

	DisableTokenCache bool          `json:"disable_token_cache" mapstructure:"disable_token_cache" ini:"disable_token_cache" yaml:"disable_token_cache"`
	RequestTimeout    time.Duration `json:"request_timeout" mapstructure:"request_timeout" ini:"request_timeout" yaml:"request_timeout"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type FeishuAppType added in v0.4.0

type FeishuAppType string
const (
	FeishuAppTypeSelfBuilt   FeishuAppType = "SelfBuilt"
	FeishuAppTypeMarketplace FeishuAppType = "Marketplace"
)

type Grpc added in v0.4.0

type Grpc struct {
	Listen                string `json:"listen" mapstructure:"listen" ini:"listen" yaml:"listen" default:"127.0.0.1"`
	Port                  int    `json:"port" mapstructure:"port" ini:"port" yaml:"port" default:"11500"`
	MaxRecvMsgSize        int    `json:"max_recv_msg_size" mapstructure:"max_recv_msg_size" ini:"max_recv_msg_size" yaml:"max_recv_msg_size"`
	MaxSendMsgSize        int    `json:"max_send_msg_size" mapstructure:"max_send_msg_size" ini:"max_send_msg_size" yaml:"max_send_msg_size"`
	InitialWindowSize     int32  `json:"initial_window_size" mapstructure:"initial_window_size" ini:"initial_window_size" yaml:"initial_window_size"`
	InitialConnWindowSize int32  `` /* 134-byte string literal not displayed */

	KeepaliveTime         time.Duration `json:"keepalive_time" mapstructure:"keepalive_time" ini:"keepalive_time" yaml:"keepalive_time"`
	KeepaliveTimeout      time.Duration `json:"keepalive_timeout" mapstructure:"keepalive_timeout" ini:"keepalive_timeout" yaml:"keepalive_timeout"`
	MaxConnectionIdle     time.Duration `json:"max_connection_idle" mapstructure:"max_connection_idle" ini:"max_connection_idle" yaml:"max_connection_idle"`
	MaxConnectionAge      time.Duration `json:"max_connection_age" mapstructure:"max_connection_age" ini:"max_connection_age" yaml:"max_connection_age"`
	MaxConnectionAgeGrace time.Duration `` /* 134-byte string literal not displayed */

	EnableTLS         bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile          string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile           string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile            string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	EnableReflection  bool   `json:"enable_reflection" mapstructure:"enable_reflection" ini:"enable_reflection" yaml:"enable_reflection"`
	EnableHealthCheck bool   `json:"enable_health_check" mapstructure:"enable_health_check" ini:"enable_health_check" yaml:"enable_health_check"`
	Enable            bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Influxdb added in v0.4.0

type Influxdb struct {
	Host   string `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port   uint   `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Token  string `json:"token" mapstructure:"token" ini:"token" yaml:"token"`
	Org    string `json:"org" mapstructure:"org" ini:"org" yaml:"org"`
	Bucket string `json:"bucket" mapstructure:"bucket" ini:"bucket" yaml:"bucket"`

	// Write options
	BatchSize        uint          `json:"batch_size" mapstructure:"batch_size" ini:"batch_size" yaml:"batch_size"`
	FlushInterval    time.Duration `json:"flush_interval" mapstructure:"flush_interval" ini:"flush_interval" yaml:"flush_interval"`
	RetryInterval    time.Duration `json:"retry_interval" mapstructure:"retry_interval" ini:"retry_interval" yaml:"retry_interval"`
	MaxRetries       uint          `json:"max_retries" mapstructure:"max_retries" ini:"max_retries" yaml:"max_retries"`
	RetryBufferLimit uint          `json:"retry_buffer_limit" mapstructure:"retry_buffer_limit" ini:"retry_buffer_limit" yaml:"retry_buffer_limit"`
	MaxRetryInterval time.Duration `json:"max_retry_interval" mapstructure:"max_retry_interval" ini:"max_retry_interval" yaml:"max_retry_interval"`
	MaxRetryTime     time.Duration `json:"max_retry_time" mapstructure:"max_retry_time" ini:"max_retry_time" yaml:"max_retry_time"`
	ExponentialBase  uint          `json:"exponential_base" mapstructure:"exponential_base" ini:"exponential_base" yaml:"exponential_base"`
	Precision        time.Duration `json:"precision" mapstructure:"precision" ini:"precision" yaml:"precision"`
	UseGZip          bool          `json:"use_gzip" mapstructure:"use_gzip" ini:"use_gzip" yaml:"use_gzip"`

	// TLS configuration
	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	// Advanced options
	DefaultTags map[string]string `json:"default_tags" mapstructure:"default_tags" ini:"default_tags" yaml:"default_tags"`
	AppName     string            `json:"app_name" mapstructure:"app_name" ini:"app_name" yaml:"app_name"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Kafka added in v0.4.0

type Kafka struct {
	Brokers  []string `json:"brokers" mapstructure:"brokers" ini:"brokers" yaml:"brokers"`
	ClientID string   `json:"client_id" mapstructure:"client_id" ini:"client_id" yaml:"client_id"`
	Version  string   `json:"version" mapstructure:"version" ini:"version" yaml:"version"`

	SASL SASL `json:"sasl" mapstructure:"sasl" ini:"sasl" yaml:"sasl"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Producer Producer `json:"producer" mapstructure:"producer" ini:"producer" yaml:"producer"`
	Consumer Consumer `json:"consumer" mapstructure:"consumer" ini:"consumer" yaml:"consumer"`
	Timeout  Timeout  `json:"timeout" mapstructure:"timeout" ini:"timeout" yaml:"timeout"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Ldap added in v0.4.0

type Ldap struct {
	Host           string        `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port           int           `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	BaseDN         string        `json:"base_dn" mapstructure:"base_dn" ini:"base_dn" yaml:"base_dn"`
	BindDN         string        `json:"bind_dn" mapstructure:"bind_dn" ini:"bind_dn" yaml:"bind_dn"`
	BindPassword   string        `json:"bind_password" mapstructure:"bind_password" ini:"bind_password" yaml:"bind_password"`
	Attributes     []string      `json:"attributes" mapstructure:"attributes" ini:"attributes" yaml:"attributes"`
	Filter         string        `json:"filter" mapstructure:"filter" ini:"filter" yaml:"filter"`
	GroupFilter    string        `json:"group_filter" mapstructure:"group_filter" ini:"group_filter" yaml:"group_filter"`
	UserFilter     string        `json:"user_filter" mapstructure:"user_filter" ini:"user_filter" yaml:"user_filter"`
	GroupDN        string        `json:"group_dn" mapstructure:"group_dn" ini:"group_dn" yaml:"group_dn"`
	UserDN         string        `json:"user_dn" mapstructure:"user_dn" ini:"user_dn" yaml:"user_dn"`
	GroupAttribute string        `json:"group_attribute" mapstructure:"group_attribute" ini:"group_attribute" yaml:"group_attribute"`
	UserAttribute  string        `json:"user_attribute" mapstructure:"user_attribute" ini:"user_attribute" yaml:"user_attribute"`
	Scope          int           `json:"scope" mapstructure:"scope" ini:"scope" yaml:"scope"`
	RequestTimeout time.Duration `json:"request_timeout" mapstructure:"request_timeout" ini:"request_timeout" yaml:"request_timeout"`
	ConnTimeout    time.Duration `json:"conn_timeout" mapstructure:"conn_timeout" ini:"conn_timeout" yaml:"conn_timeout"`
	Referrals      bool          `json:"referrals" mapstructure:"referrals" ini:"referrals" yaml:"referrals"`
	Deref          int           `json:"deref" mapstructure:"deref" ini:"deref" yaml:"deref"`
	PageSize       int           `json:"page_size" mapstructure:"page_size" ini:"page_size" yaml:"page_size"`
	Heartbeat      time.Duration `json:"heartbeat" mapstructure:"heartbeat" ini:"heartbeat" yaml:"heartbeat"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Logger added in v0.4.0

type Logger struct {
	// Dir specifies which direcotory log to.
	Dir string `json:"dir" ini:"dir" yaml:"dir" mapstructure:"dir"`

	// Prefix specifies the log prefix.
	// You can set the prefix name to your project name.
	Prefix string `json:"prefix" ini:"prefix" yaml:"prefix" mapstructure:"prefix"`

	// File specifies the which file log to.
	// If value is "/dev/stdout", log to os.Stdout.
	// If value is "/dev/stderr", log to os.Stderr.
	// If value is empty(length is zero), log to os.Stdout.
	File string `json:"file" ini:"file" yaml:"file" mapstructure:"file"`

	// Level specifies the log level,  supported values are: (error|warn|warning|info|debug).
	// The value default to "info" and ignore case.
	Level string `json:"level" ini:"level" yaml:"level" mapstructure:"level"`

	// Format specifies the log format, supported values are: (json|text).
	// The Value default to "text" and ignore case.
	Format string `json:"format" ini:"format" yaml:"format" mapstructure:"format"`

	// Encoder is the same as LogFormat.
	Encoder string `json:"encoder" ini:"encoder" yaml:"encoder" mapstructure:"encoder"`

	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename.
	// uint is "day" and default to 7.
	MaxAge uint `json:"max_age" ini:"max_age" yaml:"max_age" mapstructure:"max_age"`

	// MaxSize is the maximum size in megabytes of the log file before it gets
	// rotated, default to 1MB.
	MaxSize uint `json:"max_size" ini:"max_size" yaml:"max_size" mapstructure:"max_size"`

	// MaxBackups is the maximum number of old log files to retain.
	// The value default to 3.
	MaxBackups uint `json:"max_backups" ini:"max_backups" yaml:"max_backups" mapstructure:"max_backups"`
}

Logger represents section "logger" for client-side or server-side configuration, and there is only one copy during the application entire lifetime.

type Minio added in v0.4.0

type Minio struct {
	Endpoint     string        `json:"endpoint" mapstructure:"endpoint" ini:"endpoint" yaml:"endpoint"`
	AccessKey    string        `json:"access_key" mapstructure:"access_key" ini:"access_key" yaml:"access_key"`
	SecretKey    string        `json:"secret_key" mapstructure:"secret_key" ini:"secret_key" yaml:"secret_key"`
	Bucket       string        `json:"bucket" mapstructure:"bucket" ini:"bucket" yaml:"bucket"`
	Location     string        `json:"location" mapstructure:"location" ini:"location" yaml:"location"`
	Secure       bool          `json:"secure" mapstructure:"secure" ini:"secure" yaml:"secure"`
	Region       string        `json:"region" mapstructure:"region" ini:"region" yaml:"region"`
	Timeout      time.Duration `json:"timeout" mapstructure:"timeout" ini:"timeout" yaml:"timeout"`
	PartSize     int64         `json:"part_size" mapstructure:"part_size" ini:"part_size" yaml:"part_size"`
	Concurrency  int           `json:"concurrency" mapstructure:"concurrency" ini:"concurrency" yaml:"concurrency"`
	Compress     bool          `json:"compress" mapstructure:"compress" ini:"compress" yaml:"compress"`
	Trace        bool          `json:"trace" mapstructure:"trace" ini:"trace" yaml:"trace"`
	SessionToken string        `json:"session_token" mapstructure:"session_token" ini:"session_token" yaml:"session_token"`
	UseIAM       bool          `json:"use_iam" mapstructure:"use_iam" ini:"use_iam" yaml:"use_iam"`
	UseSTS       bool          `json:"use_sts" mapstructure:"use_sts" ini:"use_sts" yaml:"use_sts"`
	IAMEndpoint  string        `json:"iam_endpoint" mapstructure:"iam_endpoint" ini:"iam_endpoint" yaml:"iam_endpoint"`
	STSEndpoint  string        `json:"sts_endpoint" mapstructure:"sts_endpoint" ini:"sts_endpoint" yaml:"sts_endpoint"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Mode

type Mode string

type Mongo added in v0.4.0

type Mongo struct {
	Host        string `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port        int    `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Username    string `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password    string `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	Database    string `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	AuthSource  string `json:"auth_source" mapstructure:"auth_source" ini:"auth_source" yaml:"auth_source"`
	MaxPoolSize uint64 `json:"max_pool_size" mapstructure:"max_pool_size" ini:"max_pool_size" yaml:"max_pool_size"`
	MinPoolSize uint64 `json:"min_pool_size" mapstructure:"min_pool_size" ini:"min_pool_size" yaml:"min_pool_size"`

	ConnectTimeout         time.Duration `json:"connect_timeout" mapstructure:"connect_timeout" ini:"connect_timeout" yaml:"connect_timeout"`
	ServerSelectionTimeout time.Duration `` /* 134-byte string literal not displayed */
	MaxConnIdleTime        time.Duration `json:"max_conn_idle_time" mapstructure:"max_conn_idle_time" ini:"max_conn_idle_time" yaml:"max_conn_idle_time"`
	MaxConnecting          uint64        `json:"max_connecting" mapstructure:"max_connecting" ini:"max_connecting" yaml:"max_connecting"`

	ReadConcern  ReadConcern  `json:"read_concern" mapstructure:"read_concern" ini:"read_concern" yaml:"read_concern"`
	WriteConcern WriteConcern `json:"write_concern" mapstructure:"write_concern" ini:"write_concern" yaml:"write_concern"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Mqtt added in v0.4.0

type Mqtt struct {
	Addr               string        `json:"addr" mapstructure:"addr" ini:"addr" yaml:"addr"`
	Username           string        `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password           string        `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	ClientPrefix       string        `json:"client_prefix" mapstructure:"client_prefix" ini:"client_prefix" yaml:"client_prefix"`
	ConnectTimeout     time.Duration `json:"connect_timeout" mapstructure:"connect_timeout" ini:"connect_timeout" yaml:"connect_timeout"`
	Keepalive          time.Duration `json:"keepalive" mapstructure:"keepalive" ini:"keepalive" yaml:"keepalive"`
	CleanSession       bool          `json:"clean_session" mapstructure:"clean_session" ini:"clean_session" yaml:"clean_session"`
	AutoReconnect      bool          `json:"auto_reconnect" mapstructure:"auto_reconnect" ini:"auto_reconnect" yaml:"auto_reconnect"`
	UseTLS             bool          `json:"use_tls" mapstructure:"use_tls" ini:"use_tls" yaml:"use_tls"`
	CertFile           string        `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string        `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	InsecureSkipVerify bool          `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`
	Enable             bool          `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type MySQL added in v0.4.0

type MySQL struct {
	Host     string `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port     uint   `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Database string `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	Username string `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password string `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	Charset  string `json:"charset" mapstructure:"charset" ini:"charset" yaml:"charset"`
	Enable   bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Nats added in v0.4.0

type Nats struct {
	Addrs           []string `json:"addrs" mapstructure:"addrs" ini:"addrs" yaml:"addrs"`
	ClientName      string   `json:"client_name" mapstructure:"client_name" ini:"client_name" yaml:"client_name"`
	Username        string   `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password        string   `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	Token           string   `json:"token" mapstructure:"token" ini:"token" yaml:"token"`
	CredentialsFile string   `json:"credentials_file" mapstructure:"credentials_file" ini:"credentials_file" yaml:"credentials_file"`
	NKeyFile        string   `json:"nkey_file" mapstructure:"nkey_file" ini:"nkey_file" yaml:"nkey_file"`

	MaxReconnects      int           `json:"max_reconnects" mapstructure:"max_reconnects" ini:"max_reconnects" yaml:"max_reconnects"`
	ReconnectWait      time.Duration `json:"reconnect_wait" mapstructure:"reconnect_wait" ini:"reconnect_wait" yaml:"reconnect_wait"`
	ReconnectJitter    time.Duration `json:"reconnect_jitter" mapstructure:"reconnect_jitter" ini:"reconnect_jitter" yaml:"reconnect_jitter"`
	ReconnectJitterTLS time.Duration `json:"reconnect_jitter_tls" mapstructure:"reconnect_jitter_tls" ini:"reconnect_jitter_tls" yaml:"reconnect_jitter_tls"`

	ConnectTimeout      time.Duration `json:"connect_timeout" mapstructure:"connect_timeout" ini:"connect_timeout" yaml:"connect_timeout"`
	PingInterval        time.Duration `json:"ping_interval" mapstructure:"ping_interval" ini:"ping_interval" yaml:"ping_interval"`
	MaxPingsOutstanding int           `json:"max_pings_outstanding" mapstructure:"max_pings_outstanding" ini:"max_pings_outstanding" yaml:"max_pings_outstanding"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Postgres added in v0.4.0

type Postgres struct {
	Host     string `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port     uint   `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Database string `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	Username string `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password string `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	SSLMode  string `json:"sslmode" mapstructure:"sslmode" ini:"sslmode" yaml:"sslmode"`
	TimeZone string `json:"timezone" mapstructure:"timezone" ini:"timezone" yaml:"timezone"`
	Enable   bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Producer added in v0.4.0

type Producer struct {
	RequiredAcks    int    `json:"required_acks" mapstructure:"required_acks" ini:"required_acks" yaml:"required_acks"`
	Retries         int    `json:"retries" mapstructure:"retries" ini:"retries" yaml:"retries"`
	Compression     string `json:"compression" mapstructure:"compression" ini:"compression" yaml:"compression"`
	MaxMessageBytes int    `json:"max_message_bytes" mapstructure:"max_message_bytes" ini:"max_message_bytes" yaml:"max_message_bytes"`
}

Producer defines Kafka producer specific configuration

type ReadConcern added in v0.4.0

type ReadConcern string
const (
	ReadConcernLocal        ReadConcern = "local"
	ReadConcernMajority     ReadConcern = "majority"
	ReadConcernAvailable    ReadConcern = "available"
	ReadConcernLinearizable ReadConcern = "linearizable"
	ReadConcernSnapshot     ReadConcern = "snapshot"
)

type Redis added in v0.4.0

type Redis struct {
	Addr        string        `json:"addr" mapstructure:"addr" ini:"addr" yaml:"addr"`
	Addrs       []string      `json:"addrs" mapstructure:"addrs" ini:"addrs" yaml:"addrs"`
	DB          int           `json:"db" mapstructure:"db" ini:"db" yaml:"db"`
	Password    string        `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	Namespace   string        `json:"namespace" mapstructure:"namespace" ini:"namespace" yaml:"namespace"`
	PoolSize    int           `json:"pool_size" mapstructure:"pool_size" ini:"pool_size" yaml:"pool_size"`
	Expiration  time.Duration `json:"expiration" mapstructure:"expiration" ini:"expiration" yaml:"expiration"`
	ClusterMode bool          `json:"cluster_mode" mapstructure:"cluster_mode" ini:"cluster_mode" yaml:"cluster_mode"`

	DialTimeout     time.Duration `json:"dial_timeout" mapstructure:"dial_timeout" ini:"dial_timeout" yaml:"dial_timeout"`
	ReadTimeout     time.Duration `json:"read_timeout" mapstructure:"read_timeout" ini:"read_timeout" yaml:"read_timeout"`
	WriteTimeout    time.Duration `json:"write_timeout" mapstructure:"write_timeout" ini:"write_timeout" yaml:"write_timeout"`
	MinIdleConns    int           `json:"min_idle_conns" mapstructure:"min_idle_conns" ini:"min_idle_conns" yaml:"min_idle_conns"`
	MaxRetries      int           `json:"max_retries" mapstructure:"max_retries" ini:"max_retries" yaml:"max_retries"`
	MinRetryBackoff time.Duration `json:"min_retry_backoff" mapstructure:"min_retry_backoff" ini:"min_retry_backoff" yaml:"min_retry_backoff"`
	MaxRetryBackoff time.Duration `json:"max_retry_backoff" mapstructure:"max_retry_backoff" ini:"max_retry_backoff" yaml:"max_retry_backoff"`

	EnableTLS          bool   `json:"enable_tls" mapstructure:"enable_tls" ini:"enable_tls" yaml:"enable_tls"`
	CertFile           string `json:"cert_file" mapstructure:"cert_file" ini:"cert_file" yaml:"cert_file"`
	KeyFile            string `json:"key_file" mapstructure:"key_file" ini:"key_file" yaml:"key_file"`
	CAFile             string `json:"ca_file" mapstructure:"ca_file" ini:"ca_file" yaml:"ca_file"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" mapstructure:"insecure_skip_verify" ini:"insecure_skip_verify" yaml:"insecure_skip_verify"`

	Enable bool `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type S3 added in v0.4.0

type S3 struct {
	Endpoint        string `json:"endpoint" mapstructure:"endpoint" ini:"endpoint" yaml:"endpoint"`
	Region          string `json:"region" mapstructure:"region" ini:"region" yaml:"region"`
	AccessKeyID     string `json:"access_key_id" mapstructure:"access_key_id" ini:"access_key_id" yaml:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key" mapstructure:"secret_access_key" ini:"secret_access_key" yaml:"secret_access_key"`
	Bucket          string `json:"bucket" mapstructure:"bucket" ini:"bucket" yaml:"bucket"`
	UseSsl          bool   `json:"use_ssl" mapstructure:"use_ssl" ini:"use_ssl" yaml:"use_ssl"`
	Enable          bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type SASL added in v0.4.0

type SASL struct {
	Enable    bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
	Mechanism string `json:"mechanism" mapstructure:"mechanism" ini:"mechanism" yaml:"mechanism"`
	Username  string `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password  string `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
}

SASL defines SASL authentication parameters

type SQLServer added in v0.4.0

type SQLServer struct {
	Host        string `json:"host" mapstructure:"host" ini:"host" yaml:"host"`
	Port        uint   `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	Database    string `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	Username    string `json:"username" mapstructure:"username" ini:"username" yaml:"username"`
	Password    string `json:"password" mapstructure:"password" ini:"password" yaml:"password"`
	Encrypt     bool   `json:"encrypt" mapstructure:"encrypt" ini:"encrypt" yaml:"encrypt"`
	TrustServer bool   `json:"trust_server" mapstructure:"trust_server" ini:"trust_server" yaml:"trust_server"`
	AppName     string `json:"app_name" mapstructure:"app_name" ini:"app_name" yaml:"app_name"`
	Enable      bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Scope added in v0.4.0

type Scope int

Scope represents the search scope

const (
	// ScopeBaseObject indicates a base object search
	ScopeBaseObject Scope = 0
	// ScopeSingleLevel indicates a single level search
	ScopeSingleLevel Scope = 1
	// ScopeWholeSubtree indicates a whole subtree search
	ScopeWholeSubtree Scope = 2
)

type Server added in v0.4.0

type Server struct {
	Mode       Mode   `json:"mode" mapstructure:"mode" ini:"mode" yaml:"mode"`
	Listen     string `json:"listen" mapstructure:"listen" ini:"listen" yaml:"listen"`
	Port       int    `json:"port" mapstructure:"port" ini:"port" yaml:"port"`
	DB         DB     `json:"db" mapstructure:"db" ini:"db" yaml:"db"`
	Domain     string `json:"domain" mapstructure:"domain" ini:"domain" yaml:"domain"`
	EnableRBAC bool   `json:"enable_rbac" mapstructure:"enable_rbac" ini:"enable_rbac" yaml:"enable_rbac"`

	CircuitBreaker CircuitBreaker `json:"circuit_breaker" mapstructure:"circuit_breaker" ini:"circuit_breaker" yaml:"circuit_breaker"`
}

type Sqlite added in v0.4.0

type Sqlite struct {
	Path     string `json:"path" mapstructure:"path" ini:"path" yaml:"path"`
	Database string `json:"database" mapstructure:"database" ini:"database" yaml:"database"`
	IsMemory bool   `json:"is_memory" mapstructure:"is_memory" ini:"is_memory" yaml:"is_memory"`
	Enable   bool   `json:"enable" mapstructure:"enable" ini:"enable" yaml:"enable"`
}

type Timeout added in v0.4.0

type Timeout struct {
	Dial  time.Duration `json:"dial" mapstructure:"dial" ini:"dial" yaml:"dial"`
	Read  time.Duration `json:"read" mapstructure:"read" ini:"read" yaml:"read"`
	Write time.Duration `json:"write" mapstructure:"write" ini:"write" yaml:"write"`
}

Timeout defines connection timeouts

type WriteConcern added in v0.4.0

type WriteConcern string
const (
	WriteConcernMajority  WriteConcern = "majority"
	WriteConcernJournaled WriteConcern = "journaled"
	WriteConcernW0        WriteConcern = "0"
	WriteConcernW1        WriteConcern = "1"
	WriteConcernW2        WriteConcern = "2"
	WriteConcernW3        WriteConcern = "3"
	WriteConcernW4        WriteConcern = "4"
	WriteConcernW5        WriteConcern = "5"
	WriteConcernW6        WriteConcern = "6"
	WriteConcernW7        WriteConcern = "7"
	WriteConcernW8        WriteConcern = "8"
	WriteConcernW9        WriteConcern = "9"
)

Jump to

Keyboard shortcuts

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