config

package
v0.6.27 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpPort = "HTTP_PORT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppVersion      string `mapstructure:"APP_VERSION"`
	Env             string `mapstructure:"ENV"`
	ServiceName     string `mapstructure:"SERVICE_NAME"`
	ServiceMainPath string `mapstructure:"SERVICE_MAIN_PATH"`
	Server          Server
	Logger          Logger
	MongoDB         MongoDB
	Kafka           Kafka
	Http            Http
	Redis           Redis
	Sentry          Sentry
	Lightstep       Lightstep
	Postgres        Postgres
	HTTPClient      HTTPClient
}

Config of application

func ParseConfig

func ParseConfig() (*Config, error)

ParseConfig Parse config file

type HTTPClient added in v0.4.2

type HTTPClient struct {
	InternalURL    string  `mapstructure:"INTERNAL_URL"`
	XApplicationID *string `mapstructure:"X_APPLICATION_ID"`
	RetryCount     int     `mapstructure:"RETRY_COUNT"`
	RetryWaitTime  time.Duration
	Debug          bool
}

type Http

type Http struct {
	Port              string `mapstructure:"HTTP_PORT"`
	PprofPort         string
	Timeout           time.Duration
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
	CookieLifeTime    int
	SessionCookieName string
}

type Kafka

type Kafka struct {
	Brokers  []string `mapstructure:"KAFKA_BROKERS"`
	Username string   `mapstructure:"KAFKA_USERNAME"`
}

type Lightstep added in v0.3.8

type Lightstep struct {
	AccessToken string `mapstructure:"LIGHTSTEP_ACCESS_TOKEN"`
}

type Logger

type Logger struct {
	DisableCaller     bool   `mapstructure:"LOGGER_DISABLE_CALLER"`
	DisableStacktrace bool   `mapstructure:"LOGGER_DISABLE_STACKTRACE"`
	Encoding          string `mapstructure:"LOGGER_ENCODING"`
	Level             string `mapstructure:"LOGGER_LEVEL"`
}

Logger config

type MongoDB

type MongoDB struct {
	URI         string `mapstructure:"MONGODB_URI"`
	User        string `mapstructure:"MONGODB_USER"`
	Password    string `mapstructure:"MONGODB_PASSWORD"`
	DB          string `mapstructure:"MONGODB_DB"`
	MaxPoolSize uint64
	MinPoolSize uint64
	RetryWrites bool
}

type Postgres added in v0.3.10

type Postgres struct {
	Host     string  `mapstructure:"POSTGRES_HOST"`
	User     string  `mapstructure:"POSTGRES_USER"`
	Password string  `mapstructure:"POSTGRES_PASSWORD"`
	DB       string  `mapstructure:"POSTGRES_DB"`
	Port     uint64  `mapstructure:"POSTGRES_PORT"`
	TimeZone *string `mapstructure:"POSTGRES_TIMEZONE"`
}

type Redis

type Redis struct {
	RedisAddr      string  `mapstructure:"REDIS_ADDR"`
	RedisPassword  *string `mapstructure:"REDIS_PASSWORD"`
	RedisDB        string  `mapstructure:"REDIS_DB"`
	RedisDefaultDB string  `mapstructure:"REDIS_DEFAULT_DB"`
	MinIdleConn    int
	PoolSize       int
	PoolTimeout    time.Duration
	DB             int
}

type Sentry

type Sentry struct {
	SentryDSN        string  `mapstructure:"SENTRY_DSN"`
	TracesSampleRate float64 `mapstructure:"SENTRY_TRACES_SAMPLE_RATE"`
}

type Server

type Server struct {
	Port              string `mapstructure:"PORT"`
	Development       bool   `mapstructure:"DEVELOPMENT"`
	Timeout           time.Duration
	ReadTimeout       time.Duration
	WriteTimeout      time.Duration
	MaxConnectionIdle time.Duration
	MaxConnectionAge  time.Duration
	Kafka             Kafka
}

Server config

Jump to

Keyboard shortcuts

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