config

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(cfg *Config) error

Validate validates the parsed config.

Types

type Auth

type Auth struct {
	/* user name to authenticate. If empty, no authentication */
	Username string `json:"username"`

	/* hash of the password. Use revproxyhashry to hash it */
	PasswordHash string `json:"password_hash"`
}

Auth represents an authentication by a tuple (username, password hash).

type Config

type Config struct {
	Auths          map[string]*Auth `json:"auths"`
	Domain         string           `json:"domain"`
	Routes         []Route          `json:"routes"`
	SslKeyPath     string           `json:"ssl_key_path"`
	SslCertPath    string           `json:"ssl_cert_path"`
	LetsencryptDir string           `json:"letsencrypt_dir"`
	HttpAddress    string           `json:"http_address"`
	HttpsAddress   string           `json:"https_address"`
}

Config represents a parsed config JSON file.

func Load

func Load(path string) (cfg *Config, err error)

Load loads and parses the config file from the given path.

type Route

type Route struct {
	/* Route prefix */
	Prefix string `json:"prefix"`

	/*
		path to the target.
		If a directory, everything beneath it will be served beneath the prefix.
		If an URL, redirects to that URL after stripping the prefix.
	*/
	Target  string   `json:"target"`
	AuthIDs []string `json:"auths"`
}

Route represents a route of a reverse proxy.

Jump to

Keyboard shortcuts

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