config

package
v0.0.0-...-a4c28fd Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name           string `env-required:"true" json:"name"  yaml:"name"    env:"APP_NAME"`
	Version        string `env-required:"true" json:"version"  yaml:"version" env:"APP_VERSION"`
	ConfigFileName string `env:"CONFIG"`
	Author         string `json:"author" yml:"author" env:"AUTHOR" envDefault:"Soviet Union"`
}

type Config

type Config struct {
	App     `json:"app" yaml:"app"`
	Storage `json:"storage" yaml:"storage"`
	Cookie  `json:"cookie" yaml:"cookie"`
	JWT     `json:"jwt" yml:"jwt"`
	GRPC    `json:"grpc" yml:"grpc"`
	Log     `json:"log" yml:"log"`
	HTTP    `json:"http" yaml:"http"`
}

func GetConfig

func GetConfig() *Config

GetConfig (singleton) возвращает инициализированную структуру конфига.

type Cookie struct {
	AccessTokenName string `env-required:"true" yaml:"access_token_name" env:"ACCESS_TOKEN_NAME" envDefault:"access_token"`
	SecretKey       string `env-required:"true" yaml:"secret_key" env:"SECRET_KEY" envDefault:"RtsynerpoGIYdab_s234r"` // cookie encrypt application
}

type GRPC

type GRPC struct {
	Port string `env-required:"true" json:"port" yaml:"port" env:"GRPC_PORT"`
	Host string `env-required:"true" json:"host" yaml:"host" env:"GRPC_HOST"`
}

type HTTP

type HTTP struct {
	TrustedSubnet        string `json:"trusted_subnet" yml:"trusted_subnet"  env:"TRUSTED_SUBNET"`
	BaseURL              string `json:"base_url" yml:"base_url" env:"BASE_URL"`
	ServerAddress        string `json:"server_address" yml:"server_address" env:"RUN_ADDRESS"`
	ServerDomain         string `env-required:"true" json:"server_domain" yml:"server_domain" env:"SERVER_DOMAIN"`
	CertsDir             string `json:"certs_dir" yml:"certs_dir" env:"CERTS_DIR"`
	EnableHTTPS          bool   `env:"ENABLE_HTTPS"`
	ResolveIPUsingHeader bool   `env:"RESOLVE_IP_USING_HEADER"`
}

type JWT

type JWT struct {
	// SECRET_KEY ключ шифрования для JWT токена авторизации
	Secret   string `env-required:"true" json:"secret" yml:"secret" env:"SECRET_JWT"`
	HashSalt string `env-required:"true" json:"hash_salt" yml:"hash_salt" env:"HASH_SALT_JWT"`
}

type Log

type Log struct {
	// LOG_LEVEL переменная окружения, содержит значение уровня логирования проекта
	Level string `env-required:"true" json:"log_level"  yaml:"log_level"  env:"LOG_LEVEL"`
}

type Storage

type Storage struct {
	// FILE_STORAGE_PATH путь до файла с сокращёнными URL (директории не создаёт)
	FileStorage string `json:"file_storage" yml:"file_storage" env:"FILE_STORAGE_PATH"`
	// Строка с адресом подключения к БД, например для PostgreSQL (драйвер pgx): postgres://username:password@localhost:5432/database_name
	ConnectDB string `json:"connect_db" yml:"connect_db" env:"DATABASE_URI"`
}

Jump to

Keyboard shortcuts

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