appconf

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ServiceName = "game-library-auth"

ServiceName - service name

Variables

This section is empty.

Functions

func Load added in v1.2.0

func Load[T any]() (*T, error)

Load reads config from .env file (if present) and environment variables into T and validates it. T must be a struct whose fields are config sections implementing Validate with a value receiver

func Validate added in v1.2.0

func Validate(c any) error

Validate validates every section of config struct c. Every field of c must implement Validate with a value receiver

Types

type API added in v1.2.0

type API struct {
	Log         Log         `mapstructure:",squash"`
	DB          DB          `mapstructure:",squash"`
	Web         Web         `mapstructure:",squash"`
	Debug       Debug       `mapstructure:",squash"`
	Auth        Auth        `mapstructure:",squash"`
	OAuth       OAuth       `mapstructure:",squash"`
	Jaeger      Jaeger      `mapstructure:",squash"`
	Graylog     Graylog     `mapstructure:",squash"`
	EmailSender EmailSender `mapstructure:",squash"`
	InfoAPI     InfoAPI     `mapstructure:",squash"`
}

API - api service configuration

type Auth

type Auth struct {
	PrivateKeyFile   string        `mapstructure:"AUTH_PRIVATEKEYFILE"`
	SigningAlgorithm string        `mapstructure:"AUTH_SIGNINGALG"`
	Issuer           string        `mapstructure:"AUTH_ISSUER"`
	AccessTokenTTL   time.Duration `mapstructure:"AUTH_ACCESSTOKENTTL"`
	RefreshTokenTTL  time.Duration `mapstructure:"AUTH_REFRESHTOKENTTL"`
}

Auth represents settings for authentication and authorization

func (Auth) Validate added in v1.2.0

func (c Auth) Validate() error

Validate validates auth settings

type DB

type DB struct {
	DSN string `mapstructure:"DB_DSN"`
}

DB represents settings for database

func (DB) Validate added in v1.2.0

func (c DB) Validate() error

Validate validates db settings

type Debug added in v1.2.0

type Debug struct {
	Address string `mapstructure:"APP_DEBUG_ADDRESS"`
}

Debug represents settings for debug server (pprof, metrics, health probes)

func (Debug) Validate added in v1.2.0

func (c Debug) Validate() error

Validate validates debug server settings

type EmailDelivery added in v1.2.0

type EmailDelivery struct {
	APIToken   string        `mapstructure:"EMAIL_SENDER_API_TOKEN"`
	APITimeout time.Duration `mapstructure:"EMAIL_SENDER_API_TIMEOUT"`
}

EmailDelivery represents settings for email provider client

func (EmailDelivery) Validate added in v1.2.0

func (c EmailDelivery) Validate() error

Validate validates email delivery settings. Timeout must not outlive a worker attempt

type EmailSender

type EmailSender struct {
	EmailFrom         string `mapstructure:"EMAIL_SENDER_EMAIL_FROM"`
	ContactEmail      string `mapstructure:"EMAIL_SENDER_CONTACT_EMAIL"`
	BaseURL           string `mapstructure:"EMAIL_SENDER_BASE_URL"`
	UnsubscribeURL    string `mapstructure:"EMAIL_SENDER_UNSUBSCRIBE_URL"`
	UnsubscribeSecret string `mapstructure:"EMAIL_SENDER_UNSUBSCRIBE_SECRET"`
}

EmailSender represents settings for composing emails

func (EmailSender) Validate added in v1.2.0

func (c EmailSender) Validate() error

Validate validates email sender settings

type Graylog

type Graylog struct {
	Address string `mapstructure:"GRAYLOG_ADDR"`
}

Graylog represents settings related to Graylog integration

func (Graylog) Validate added in v1.2.0

func (c Graylog) Validate() error

Validate validates Graylog settings

type InfoAPI

type InfoAPI struct {
	Address string        `mapstructure:"INFOAPI_ADDRESS"`
	Timeout time.Duration `mapstructure:"INFOAPI_TIMEOUT"`
}

InfoAPI represents settings for InfoAPI gRPC client

func (InfoAPI) Validate added in v1.2.0

func (c InfoAPI) Validate() error

Validate validates InfoAPI settings

type Jaeger

type Jaeger struct {
	OTLPEndpoint string `mapstructure:"JAEGER_OTLP_ENDPOINT"`
}

Jaeger represents settings for Jaeger OTLP trace export

func (Jaeger) Validate added in v1.2.0

func (c Jaeger) Validate() error

Validate validates Jaeger settings

type Log

type Log struct {
	Level string `mapstructure:"LOG_LEVEL"`
}

Log represents settings for logging

func (Log) Validate added in v1.2.0

func (c Log) Validate() error

Validate validates log settings

type Manage added in v1.2.0

type Manage struct {
	DB DB `mapstructure:",squash"`
}

Manage - database management tool configuration

type OAuth

type OAuth struct {
	Timeout            time.Duration `mapstructure:"OAUTH_TIMEOUT"`
	GoogleClientID     string        `mapstructure:"OAUTH_GOOGLECLIENTID"`
	GitHubClientID     string        `mapstructure:"OAUTH_GITHUBCLIENTID"`
	GitHubClientSecret string        `mapstructure:"OAUTH_GITHUBCLIENTSECRET"`
}

OAuth represents settings for OAuth providers

func (OAuth) Validate added in v1.2.0

func (c OAuth) Validate() error

Validate validates OAuth settings

type Web

type Web struct {
	HTTPAddress           string        `mapstructure:"APP_HTTP_ADDRESS"`
	GRPCAddress           string        `mapstructure:"APP_GRPC_ADDRESS"`
	ReadTimeout           time.Duration `mapstructure:"APP_READTIMEOUT"`
	WriteTimeout          time.Duration `mapstructure:"APP_WRITETIMEOUT"`
	AllowedCORSOrigin     string        `mapstructure:"APP_ALLOWEDCORSORIGIN"`
	RefreshCookieSameSite string        `mapstructure:"APP_REFRESH_TOKEN_COOKIE_SAMESITE"`
	RefreshCookieSecure   bool          `mapstructure:"APP_REFRESH_TOKEN_COOKIE_SECURE"`
}

Web represents settings for web server

func (Web) Validate added in v1.2.0

func (c Web) Validate() error

Validate validates web server settings

type Worker added in v1.2.0

type Worker struct {
	Log           Log           `mapstructure:",squash"`
	DB            DB            `mapstructure:",squash"`
	Debug         Debug         `mapstructure:",squash"`
	Jaeger        Jaeger        `mapstructure:",squash"`
	Graylog       Graylog       `mapstructure:",squash"`
	EmailDelivery EmailDelivery `mapstructure:",squash"`
}

Worker - notification worker configuration. Deliberately omits JWT keys, OAuth and downstream API credentials

Jump to

Keyboard shortcuts

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