app

package
v0.0.0-...-1005c5c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Overview

Package app provides self-contained application business logic and signal handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args ...string) error

Run starts the application and listens for OS signals to gracefully shutdown.

Types

type Config

type Config struct {
	ServerListenAddr string        `envconfig:"SERVER_LISTEN_ADDR" default:"127.0.0.1:8383"`
	DSN              string        `envconfig:"DSN" default:"postgres://gevulot:gevulot@localhost:5432/gevulot"`
	MockStore        bool          `envconfig:"MOCK_STORE" default:"false"`
	StatsTTL         time.Duration `envconfig:"STATS_TTL" default:"5s"`
	SseRetryTimeout  time.Duration `envconfig:"SSE_RETRY_TIMEOUT" default:"10ms"`
	LogLevel         slog.Level    `envconfig:"LOG_LEVEL" default:"info"`
}

func ParseConfig

func ParseConfig(args ...string) (Config, error)

TODO: Proper config parsing

type Runnable

type Runnable interface {
	Run() error
	Stop() error
}

type Runner

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

func NewRunner

func NewRunner(runnables ...Runnable) *Runner

func (*Runner) Run

func (r *Runner) Run() error

func (*Runner) Stop

func (r *Runner) Stop()

Stop stops all runnables. Usually this method is called only in tests.

type Store

type Store interface {
	api.Store
	Runnable
}

Jump to

Keyboard shortcuts

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