cnf

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateAndDefaults

func ValidateAndDefaults(conf *Conf)

Types

type Conf

type Conf struct {
	ListenAddress          string   `json:"listenAddress"`
	ListenPort             int      `json:"listenPort"`
	ServerReadTimeoutSecs  int      `json:"serverReadTimeoutSecs"`
	ServerWriteTimeoutSecs int      `json:"serverWriteTimeoutSecs"`
	CorsAllowedOrigins     []string `json:"corsAllowedOrigins"`
	TrustedProxies         []string `json:"trustedProxies"`

	// SourcesRootDir is mainly used to locate html/xml templates and other
	// assets so we can refer them in a relative way inside the code
	SourcesRootDir string               `json:"sourcesRootDir"`
	AssetsURLPath  string               `json:"assetsURLPath"`
	ServerInfo     *ServerInfo          `json:"serverInfo"`
	CorporaSetup   *corpus.CorporaSetup `json:"corpora"`
	Redis          *rdb.Conf            `json:"redis"`
	LogFile        string               `json:"logFile"`
	LogLevel       logging.LogLevel     `json:"logLevel"`
	TimeZone       string               `json:"timeZone"`
	// contains filtered or unexported fields
}

Conf is a global configuration of the app

func LoadConfig

func LoadConfig(path string) *Conf

func (*Conf) GetSourcePath

func (conf *Conf) GetSourcePath() string

GetSourcePath returns an absolute path of a file the config was loaded from.

func (*Conf) IsDebugMode

func (conf *Conf) IsDebugMode() bool

func (*Conf) TimezoneLocation

func (conf *Conf) TimezoneLocation() *time.Location

type ServerInfo

type ServerInfo struct {

	// ServerHost specifies an external host the service runs at.
	// (e.g. `fcs.korpus.cz`)
	ServerHost string `json:"serverHost"`

	// ServerPort specifies an external port the service listens on.
	ServerPort string `json:"serverPort"`

	// Database speicifies a concrete "sub section" of the endpoint.
	// TODO: not sure about this; In the documentation, it seems
	// like it is a URL path specifying concrete resources offered.
	Database string `json:"database"`

	// DatabaseTitle is a multi-language configuration
	// for database title. The whole section is required
	// in the config and it should at least contain the 'en'
	// translation.
	DatabaseTitle map[string]string `json:"databaseTitle"`

	// DatabaseDescription contains more information about
	// the endpoint data. The whole section is optional but
	// if present, 'en' translation is required.
	DatabaseDescription map[string]string `json:"databaseDescription"`

	DatabaseAuthor map[string]string `json:"databaseAuthor"`

	// PrimaryLanguage defines a language which is native
	// for different labels, descriptions etc.
	PrimaryLanguage string `json:"primaryLanguage"`

	// ExternalURLPath specifies an external path to the API on host
	ExternalURLPath string `json:"externalUrlPath"`
}

func (*ServerInfo) Validate

func (s *ServerInfo) Validate() error

Jump to

Keyboard shortcuts

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