app

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv[T any]() T

LoadEnv reads the environment for a command's configuration.

func Main

func Main(cfg Config, opts ...Option) int

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, opts ...Option) *App

func (*App) Run

func (a *App) Run() (runErr error)

Run serves until SIGINT/SIGTERM or a fatal error. It logs its own outcome so that the final record is still forwarded when self-logging is enabled.

type Config

type Config struct {
	LogLevel                      string        `env:"LOG_LEVEL" envDefault:"info"`
	LogConnectionString           string        `env:"SVAROG_CONN_STRING"`
	LogQueueCapacity              string        `env:"SVAROG_LOG_QUEUE_CAPACITY"`
	PostgresURL                   string        `env:"POSTGRES_URL" envDefault:"postgres://svarog:svarog@localhost:5434/svarog?sslmode=disable"`
	ServerDnsName                 string        `env:"SERVER_DNS_NAME"`
	PublicURL                     string        `env:"PUBLIC_URL"`
	HttpServerPort                int           `env:"HTTP_SERVER_PORT"`
	SessionSecret                 string        `env:"SESSION_SECRET"`
	ArchiveDir                    string        `env:"ARCHIVE_DIR"`
	ArchiveSchedulerEnabled       bool          `env:"ARCHIVE_SCHEDULER_ENABLED" envDefault:"true"`
	IngestStreamMaxBytes          int64         `env:"INGEST_STREAM_MAX_BYTES" envDefault:"0"`
	IngestAckWait                 time.Duration `env:"INGEST_ACK_WAIT" envDefault:"60s"`
	IngestAllowRetentionMigration bool          `env:"INGEST_ALLOW_RETENTION_MIGRATION" envDefault:"false"`

	ArchiveS3Bucket          string `env:"ARCHIVE_S3_BUCKET"`
	ArchiveS3Endpoint        string `env:"ARCHIVE_S3_ENDPOINT"`
	ArchiveS3Region          string `env:"ARCHIVE_S3_REGION" envDefault:"auto"`
	ArchiveS3AccessKeyID     string `env:"ARCHIVE_S3_ACCESS_KEY_ID"`
	ArchiveS3SecretAccessKey string `env:"ARCHIVE_S3_SECRET_ACCESS_KEY"`

	NatsPublicAddr  string `env:"NATS_PUBLIC_ADDR"`
	NatsAccountSeed string `env:"NATS_ACCOUNT_SEED"`
}

type Option

type Option func(*App)

func WithBroker

func WithBroker(broker natsconn.Broker) Option

Jump to

Keyboard shortcuts

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