config

package
v0.0.0-...-373d17c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CatchAll bool `json:"catch_all" toml:"catch_all"`

	Domains []*Domain `json:"domains" toml:"domains"`

	Zone   Zone   `json:"zone" toml:"zone"`
	Web    Web    `json:"web" toml:"web"`
	DNS    DNS    `json:"dns" toml:"dns"`
	WebDav WebDav `json:"webdav" toml:"webdav"`
}

func NewConfigFromFile

func NewConfigFromFile(filename string) (config *Config, err error)

NewConfigFromFile reads configuration from specified filename

func NewConfigFromJSONFile

func NewConfigFromJSONFile(filename string) (config *Config, err error)

NewConfigFromJSONFile reads configuration from JSON formatted file

func (*Config) GetDomain

func (c *Config) GetDomain(domain string) *Domain

GetDomain gets domain details from the loaded configuration. If CatchAll is enabled it will create new Domain record if it doesn't exist

func (*Config) HasDomain

func (c *Config) HasDomain(domain string) bool

HasDomain checks if domain exists in the loaded configuration

func (*Config) Refresh

func (config *Config) Refresh()

type DNS

type DNS struct {
	IP      string   `json:"ip" toml:"ip"`
	Port    int      `json:"port" toml:"port"`
	Servers []Server `json:"servers"`
}

type Domain

type Domain struct {
	Name string `json:"name" toml:"name"`

	// TODO: Not implemented yet
	LetsEncrypt bool `json:"lets_encrypt" toml:"lets_encrypt"`

	HasSSL bool `json:"has_ssl" toml:"has_ssl"`

	SSLCertificate    string `json:"ssl_certificate" toml:"ssl_certificate"`
	SSLCertificateKey string `json:"ssl_certificate_key" toml:"ssl_certificate_key"`

	Zone *Zone `json:"zone" toml:"zone"`
}

type Server

type Server struct {
	Name string `json:"name" toml:"name"`
	IP   string `json:"ip" toml:"ip"`
}

type Web

type Web struct {
	IP        string `json:"ip" toml:"ip"`
	Port      int    `json:"port" toml:"port"`
	SSLPort   int    `json:"ssl_port" toml:"ssl_port"`
	Path      string `json:"path" toml:"path"`
	AccessLog string `json:"access_log" toml:"access_log"`
	ErrorLog  string `json:"error_log" toml:"error_log"`
}

type WebDav

type WebDav struct {
	Enabled  bool   `json:"enabled" toml:"enabled"`
	Username string `json:"username" toml:"username"`
	Password string `json:"password" toml:"password"`
	Mount    string `json:"mount" toml:"mount"`
}

type Zone

type Zone struct {
	A   string `json:"A" toml:"A"`
	MX  string `json:"MX" toml:"MX"`
	TXT string `json:"TXT" toml:"TXT"`
}

Jump to

Keyboard shortcuts

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