cfg

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(dir string, funcMap template.FuncMap) error

Load loads the configuration from config.json.

func Watch

func Watch(ctx context.Context, dir string, funcMap template.FuncMap) error

Watch watches config.json for changes and automatically reloads the settings.

Types

type Analytics

type Analytics struct {
	Provider     string   `json:"provider"`
	ClientID     string   `json:"client_id"`
	ClientSecret string   `json:"client_secret"`
	Subnets      []string `json:"subnets"`
	Header       []string `json:"header"`
}

Analytics is the web analytics configuration.

type CORS

type CORS struct {
	Origins  string `json:"origins"`
	Loglevel string `json:"loglevel"`
}

CORS is the HTTP CORS configuration.

type Config

type Config struct {
	BaseDir string           `json:"-"`
	FuncMap template.FuncMap `json:"-"`

	Dev       bool      `json:"dev"`
	LogLevel  string    `json:"log_level"`
	Server    Server    `json:"server"`
	Content   Content   `json:"content"`
	CORS      CORS      `json:"cors"`
	Sass      Sass      `json:"sass"`
	JS        JS        `json:"js"`
	Analytics Analytics `json:"analytics"`
}

Config is the Oogway application config.

func Get

func Get() *Config

Get returns the configuration. This is not thread safe! In production, the watcher must be disabled!

type Content

type Content struct {
	Provider      string `json:"provider"`
	UpdateSeconds int    `json:"update_seconds"`
	Repository    string `json:"repository"`
}

Content is the content and source configuration.

type JS

type JS struct {
	Entrypoint string `json:"entrypoint"`
	Dir        string `json:"dir"`
	Watch      bool   `json:"watch"`
	Out        string `json:"out"`
	SourceMap  bool   `json:"source_map"`
}

JS is the JavaScript compiler configuration.

type Sass

type Sass struct {
	Entrypoint   string `json:"entrypoint"`
	Dir          string `json:"dir"`
	Watch        bool   `json:"watch"`
	Out          string `json:"out"`
	OutSourceMap string `json:"out_source_map"`
}

Sass is the sass compiler configuration.

type Server

type Server struct {
	Host             string `json:"host"`
	Port             int    `json:"port"`
	ShutdownTimeout  int    `json:"shutdown_time"`
	WriteTimeout     int    `json:"write_timeout"`
	ReadTimeout      int    `json:"read_timeout"`
	TLSCertFile      string `json:"tls_cert_file"`
	TLSKeyFile       string `json:"tls_key_file"`
	Hostname         string `json:"hostname"`
	SecureCookies    bool   `json:"secure_cookies"`
	CookieDomainName string `json:"cookie_domain_name"`
}

Server is the HTTP server configuration.

Jump to

Keyboard shortcuts

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