web

package
v0.0.0-...-77eda36 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(ctx context.Context, router http.Handler, cfgSSL SSLConfig, cfgHTTP HTTPConfig, logger *slog.Logger) error

ListenAndServe launches web server that listens to HTTP(S) requests

func NewRouter

func NewRouter(ph *handler.Posts, fh *handler.Feed, cfgHTTP HTTPConfig, theme string, logger *slog.Logger) http.Handler

NewRouter initialises and builds new HTTP router

Types

type HTTPConfig

type HTTPConfig struct {
	Port          int    `env:"WEB_PORT,default=8080"`
	StaticPath    string `env:"WEB_STATIC_PATH,default=/etc/rklotz/static"`
	TemplatesPath string `env:"WEB_TEMPLATES_PATH,default=/etc/rklotz/templates"`
}

HTTPConfig is the configuration for web application

type SSLConfig

type SSLConfig struct {
	Enabled  bool   `env:"SSL_ENABLED,default=false"`
	Port     int    `env:"SSL_PORT,default=8443"`
	Host     string `env:"SSL_HOST"`
	Email    string `env:"SSL_EMAIL,default=vgarvardt@gmail.com"`
	CacheDir string `env:"SSL_CACHE_DIR,default=/tmp"`
}

SSLConfig is the configuration for TLS/SSL

Jump to

Keyboard shortcuts

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