config

package
v0.0.0-...-f9bed8c Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug  bool `default:"false" envconfig:"DEBUG"`
	Server struct {
		Port uint16 `envconfig:"HTTP_PORT" default:"8000"`
		Host string `envconfig:"HTTP_HOST" default:"0.0.0.0"`
	}
	DB struct {
		User     string `envconfig:"POSTGRES_USER"`
		Password string `envconfig:"POSTGRES_PASSWORD"`
		Host     string `envconfig:"POSTGRES_HOST"`
		Port     uint16 `envconfig:"POSTGRES_PORT"`
		Database string `envconfig:"POSTGRES_DB"`
	}
	Log struct {
		Handler string `envconfig:"LOG_HANDLER" default:"tint"`
	}
	Auth struct {
		PasswordSecret string `envconfig:"AUTH_PASSWORD_SECRET"`
		JWTSecret      string `envconfig:"AUTH_JWT_SECRET"`
	}

	YooKassa YooKassaConfig
	S3       S3Config
}

func Load

func Load(envFile string) *Config

func (*Config) DBUrl

func (c *Config) DBUrl() string

func (*Config) Logger

func (c *Config) Logger() *slog.Logger

func (*Config) PGXConfig

func (c *Config) PGXConfig() *pgxpool.Config

func (*Config) Print

func (c *Config) Print()

type S3Config

type S3Config struct {
	AccessKeyID   string `envconfig:"S3_ACCESS_KEY_ID"`
	SecretKey     string `envconfig:"S3_SECRET_KEY"`
	Region        string `envconfig:"S3_REGION"`
	Bucket        string `envconfig:"S3_BUCKET"`
	EndpointURL   string `envconfig:"S3_ENDPOINT_URL"`
	RootDirectory string `envconfig:"S3_ROOT_DIRECTORY"`
}

type YooKassaConfig

type YooKassaConfig struct {
	ShopID    string `envconfig:"YOOKASSA_SHOP_ID"`
	SecretKey string `envconfig:"YOOKASSA_SECRET_KEY"`
}

Jump to

Keyboard shortcuts

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