server

package
v0.0.0-...-5c49fd7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg *Config, version string) error

Run initializes and runs web-server instance

Types

type Config

type Config struct {
	PostsDSN     string `env:"POSTS_DSN,default=file:///etc/rklotz/posts"`
	PostsPerPage int    `env:"POSTS_PERPAGE,default=10"`
	StorageDSN   string `env:"STORAGE_DSN,default=boltdb:///tmp/rklotz.db"`

	LogConfig
	web.HTTPConfig
	web.SSLConfig
	plugin.Config
	renderer.UIConfig
	renderer.RootURLConfig
}

Config represents server configuration

func LoadConfig

func LoadConfig(ctx context.Context) (*Config, error)

LoadConfig loads app settings from environment variables

type LogConfig

type LogConfig struct {
	Level slog.Level `env:"LOG_LEVEL,default=info"`
	Type  string     `env:"LOG_TYPE,default=rklotz"`
}

LogConfig represents logger configuration

func (*LogConfig) BuildLogger

func (c *LogConfig) BuildLogger() (*slog.Logger, error)

BuildLogger builds and initialises logger with the values from the config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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