config

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration object for NVGD.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFilter added in v1.8.0

func RegisterFilter(name string, v interface{})

RegisterFilter registers a filter configuration.

func RegisterProtocol

func RegisterProtocol(name string, v interface{})

RegisterProtocol registers protocol configuration.

Types

type Config

type Config struct {
	Addr string `yaml:"addr"`

	PathPrefix string `yaml:"path_prefix"`

	// ErrorLogPath specify path of access log. default is "(stderr)".
	ErrorLogPath string `yaml:"error_log"`

	// AccessLogPath specify path of access log. default is "(discard)".
	AccessLogPath string `yaml:"access_log"`

	// RootContentsFile specify file path which be served as "/" (root).
	// default is empty and no contents are served as "/".
	RootContentsFile string `yaml:"root_contents_file"`

	Protocols customConfig `yaml:"protocols,omitempty"`

	Filters customConfig `yaml:"filters,omitempty"`

	DefaultFilters FiltersMap `yaml:"default_filters,omitempty"`

	// Aliases provides custom aliases.
	Aliases map[string]string `yaml:"aliases,omitempty"`

	// AccessControlAllowOrigin specify a value for
	// "Access-Control-Allow-Origin" header put to all responses.
	// The header is not put when this is empty string.
	// Default value is empty.
	AccessControlAllowOrigin string `yaml:"access_control_allow_origin,omitempty"`
}

Config represents NVGD server configuration.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig loads a configuration from a file.

func Root added in v1.8.0

func Root() *Config

func (*Config) AccessLog

func (c *Config) AccessLog() (*log.Logger, error)

AccessLog creates a new access logger.

func (*Config) ErrorLog

func (c *Config) ErrorLog() (*log.Logger, error)

ErrorLog creates new error logger.

type Filters

type Filters []string

Filters is definition of filters.

type FiltersMap

type FiltersMap map[string]Filters

FiltersMap is map string to Filters.

Jump to

Keyboard shortcuts

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