config

package
v0.0.0-...-5e1236a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 2 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" yaml:"name" env:"APP_NAME"`
	Version string `env-required:"true" yaml:"version" env:"APP_VERSION"`
}

type Auth

type Auth struct {
	AccessTokenPrivateKey string `env-required:"false" yaml:"access_token_private_key" env:"ACCESS_TOKEN_PRIVATE_KEY"`
	AccessTokenPublicKey  string `env-required:"false" yaml:"access_token_public_key" env:"ACCESS_TOKEN_PUBLIC_KEY"`
	AccessTokenMaxAge     string `env-required:"false" yaml:"access_token_max_age" env:"ACCESS_TOKEN_MAX_AGE"`
}

type CartConfig

type CartConfig struct {
	App            `yaml:"app"`
	GRPC           `yaml:"grpc"`
	Redis          `yaml:"redis"`
	PG             `yaml:"postgres"`
	CartTaskWorker `yaml:"worker"`
	Log            `yaml:"logger"`
}

type CartTaskWorker

type CartTaskWorker struct {
	CartTTL  string `env-required:"false" yaml:"cart_ttl" env:"CART_TTL"`
	Interval string `env-required:"false" yaml:"cart_task_worker_interval" env:"CART_TASK_WORKER_INTERVAL"`
}

type Config

type Config struct {
	OrderConfig   *OrderConfig
	GatewayConfig *GatewayConfig
	UserConfig    *UserConfig
	CartConfig    *CartConfig
	ProductConfig *ProductConfig
}

func NewConfig

func NewConfig() (*Config, error)

Creates a new config entity after reading the configuration values from the YAML file and environment variables.

type GRPC

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

type GatewayConfig

type GatewayConfig struct {
	App  `yaml:"app"`
	GRPC `yaml:"grpc"`
	HTTP `yaml:"http"`
	Auth `yaml:"auth"`
	Log  `yaml:"logger"`
}

type HTTP

type HTTP struct {
	Port uint32 `env-required:"true" yaml:"port" env:"HTTP_PORT"`
	Host string `env-required:"true" yaml:"host" env:"HOST"`
}

type Log

type Log struct {
	Level string `env-required:"true" yaml:"log_level" env:"LOG_LEVEL"`
}

type OrderConfig

type OrderConfig struct {
	App  `yaml:"app"`
	GRPC `yaml:"grpc"`
	PG   `yaml:"postgres"`
	Log  `yaml:"logger"`
}

type PG

type PG struct {
	Dialect string `env-requered:"true" yaml:"dialect" env:"DIALECT"`
	URL     string `env-required:"true" yaml:"pg_url" env:"PG_URL"`
	PoolMax int    `env-required:"true" yaml:"pool_max" env:"PG_POOL_MAX"`
}

type ProductConfig

type ProductConfig struct {
	App   `yaml:"app"`
	GRPC  `yaml:"grpc"`
	Redis `yaml:"redis"`
	PG    `yaml:"postgres"`
	Log   `yaml:"logger"`
}

type Redis

type Redis struct {
	Url string `env-required:"true" yaml:"redis_url" env:"REDIS_URL"`
}

type UserConfig

type UserConfig struct {
	App  `yaml:"app"`
	GRPC `yaml:"grpc"`
	PG   `yaml:"postgres"`
	Log  `yaml:"logger"`
}

Jump to

Keyboard shortcuts

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