appconf

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

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

ServiceName - service name

Variables

This section is empty.

Functions

func Load added in v1.4.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.4.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.4.0

type API struct {
	Log     Log     `mapstructure:",squash"`
	DB      DB      `mapstructure:",squash"`
	Web     Web     `mapstructure:",squash"`
	Debug   Debug   `mapstructure:",squash"`
	Jaeger  Jaeger  `mapstructure:",squash"`
	IGDB    IGDB    `mapstructure:",squash"`
	Redis   Redis   `mapstructure:",squash"`
	Graylog Graylog `mapstructure:",squash"`
	S3      S3      `mapstructure:",squash"`
	AuthAPI AuthAPI `mapstructure:",squash"`
}

API - api service configuration

type AuthAPI

type AuthAPI struct {
	Address string        `mapstructure:"AUTHAPI_ADDRESS"`
	Timeout time.Duration `mapstructure:"AUTHAPI_TIMEOUT"`
}

AuthAPI represents settings for AuthAPI gRPC client

func (AuthAPI) Validate added in v1.4.0

func (c AuthAPI) Validate() error

Validate validates AuthAPI settings

type DB

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

DB represents settings for database

func (DB) Validate added in v1.4.0

func (c DB) Validate() error

Validate validates db settings

type Debug added in v1.4.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.4.0

func (c Debug) Validate() error

Validate validates debug server settings

type Graylog

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

Graylog represents settings related to Graylog integration

func (Graylog) Validate added in v1.4.0

func (c Graylog) Validate() error

Validate validates Graylog settings

type IGDB

type IGDB struct {
	ClientID     string        `mapstructure:"IGDB_CLIENT_ID"`
	ClientSecret string        `mapstructure:"IGDB_CLIENT_SECRET"`
	TokenURL     string        `mapstructure:"IGDB_TOKEN_URL"`
	APIURL       string        `mapstructure:"IGDB_API_URL"`
	Timeout      time.Duration `mapstructure:"IGDB_API_TIMEOUT"`
}

IGDB represents settings for IGDB client

func (IGDB) Validate added in v1.4.0

func (c IGDB) Validate() error

Validate validates IGDB 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.4.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.4.0

func (c Log) Validate() error

Validate validates log settings

type Manage added in v1.4.0

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

Manage - database management tool configuration

type OpenAI

type OpenAI struct {
	APIKey          string        `mapstructure:"OPENAI_API_KEY"`
	APIURL          string        `mapstructure:"OPENAI_API_URL"`
	ModerationModel string        `mapstructure:"OPENAI_MODERATION_MODEL"`
	VisionModel     string        `mapstructure:"OPENAI_VISION_MODEL"`
	Timeout         time.Duration `mapstructure:"OPENAI_API_TIMEOUT"`
}

OpenAI represents settings for OpenAI client

func (OpenAI) Validate added in v1.4.0

func (c OpenAI) Validate() error

Validate validates OpenAI settings

type Redis

type Redis struct {
	Address  string        `mapstructure:"REDIS_ADDR"`
	Password string        `mapstructure:"REDIS_PASSWORD"`
	TTL      time.Duration `mapstructure:"REDIS_TTL"`
}

Redis represents settings for Redis client

func (Redis) Validate added in v1.4.0

func (c Redis) Validate() error

Validate validates Redis settings

type S3

type S3 struct {
	Region          string        `mapstructure:"S3_REGION"`
	AccessKeyID     string        `mapstructure:"S3_ACCESS_KEY_ID"`
	SecretAccessKey string        `mapstructure:"S3_SECRET_ACCESS_KEY"`
	Endpoint        string        `mapstructure:"S3_ENDPOINT"`
	BucketName      string        `mapstructure:"S3_BUCKET_NAME"`
	CDNBaseURL      string        `mapstructure:"S3_CDN_BASE_URL"`
	Timeout         time.Duration `mapstructure:"S3_TIMEOUT"`
}

S3 represents settings for S3 client

func (S3) Validate added in v1.4.0

func (c S3) Validate() error

Validate validates S3 settings

type Scheduler

type Scheduler struct {
	FetchIGDBGames      string `mapstructure:"SCHED_FETCH_IGDB_GAMES"`
	UpdateTrendingIndex string `mapstructure:"SCHED_UPDATE_TRENDING_INDEX"`
	UpdateGameInfo      string `mapstructure:"SCHED_UPDATE_GAME_INFO"`
	ProcessModeration   string `mapstructure:"SCHED_PROCESS_MODERATION"`
}

Scheduler represents settings for task scheduler

func (Scheduler) Validate added in v1.4.0

func (c Scheduler) Validate() error

Validate validates scheduler 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"`
}

Web represents settings for to web server

func (Web) Validate added in v1.4.0

func (c Web) Validate() error

Validate validates web server settings

type Worker added in v1.4.0

type Worker struct {
	Log       Log       `mapstructure:",squash"`
	DB        DB        `mapstructure:",squash"`
	Debug     Debug     `mapstructure:",squash"`
	Jaeger    Jaeger    `mapstructure:",squash"`
	IGDB      IGDB      `mapstructure:",squash"`
	Scheduler Scheduler `mapstructure:",squash"`
	Redis     Redis     `mapstructure:",squash"`
	Graylog   Graylog   `mapstructure:",squash"`
	S3        S3        `mapstructure:",squash"`
	OpenAI    OpenAI    `mapstructure:",squash"`
}

Worker - background worker configuration

Jump to

Keyboard shortcuts

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