chissy

package module
v0.0.0-...-99778c7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 13 Imported by: 0

README

chissy

Documentation

Overview

Package chissy package is intended for quick web service development.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedirectToHTTPS

func RedirectToHTTPS(domains []string) http.Handler

func Static

func Static(r chi.Router, path string, root http.FileSystem)

Static conveniently sets up a http.FileServer handler to serve static files from a http.FileSystem.

Types

type Config

type Config struct {
	ProductionMode    bool          `env:"PROD"`
	LocalhostDomain   string        `env:"LOCALHOST_DOMAIN" validate:"required_if=ProductionMode false"`
	SSL               SSL           `validate:"required_if=ProductionMode true"`
	Port              uint16        `env:"PORT" validate:"min=80,max=65535"`
	ReadTimeout       time.Duration `env:"READ_TIMEOUT" default:"1m"`
	ReadHeaderTimeout time.Duration `env:"READ_HEADER_TIMEOUT" default:"15s"`
	WriteTimeout      time.Duration `env:"WRITE_TIMEOUT" default:"1m"`
	// contains filtered or unexported fields
}

Config - http service configuration compatible to settings package. https://github.com/kaatinga/settings

func NewConfig

func NewConfig() *Config

NewConfig creates new config model that later can be processed by settings package or updated manually.

func (*Config) Init

func (c *Config) Init()

func (*Config) Launch

func (c *Config) Launch(setupHandlers SetUpHandlers) error

Launch enables the configured web server with the handlers that announced in a function matched with SetUpHandlers type.

func (*Config) Terminate

func (c *Config) Terminate()

type ExtraFunc

type ExtraFunc func() error

type SSL

type SSL struct {
	Email      string `env:"EMAIL" validate:"email"`
	DomainList []string
}

type SetUpHandlers

type SetUpHandlers func(r *chi.Mux)

SetUpHandlers type to announce handlers.

Jump to

Keyboard shortcuts

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