configuration

package
v0.0.0-...-8eb1a3c Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 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 {
	// LogLevel is the minimum severity level for log messages.
	LogLevel LogLevel `yaml:"log_level"`
	// Host is the server binding address.
	Host string `yaml:"host"`
	// Port is the server listening port.
	Port int `yaml:"port"`
	// MaxConcurrentComputations is the maximum amount of concurrent
	// computations allowed.
	MaxConcurrentComputations int `yaml:"max_concurrent_computations"`
	// TLSEnabled reports whether to enable TLS.
	TLSEnabled bool `yaml:"tls_enabled"`
	// TLSCert is the TLS cert file. It is ignored if TLSEnabled is false.
	TLSCert string `yaml:"tls_cert"`
	// TLSKey is the TLS key file. It is ignored if TLSEnabled is false.
	TLSKey string `yaml:"tls_key"`
	// ModelsPath is the local path for all spaGO-compatible models.
	ModelsPath string `yaml:"models_path"`
	// LanguageModels provides the configuration for translation models
	// to be loaded and handled by the service.
	LanguageModels []LanguageModel `yaml:"language_models"`
}

Config is the main translator server configuration.

func FromYAMLFile

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

FromYAMLFile reads a Config object from a YAML file.

type LanguageModel

type LanguageModel struct {
	// Source is an identifier for the source language of translation.
	Source string `yaml:"source"`
	// Target is an identifier for the target language of translation.
	Target string `yaml:"target"`
	// Model is the name of a spaGO-compatible model.
	Model string `yaml:"model"`
}

LanguageModel identifies a single model and the identifiers for the source and target languages it supports.

type LogLevel

type LogLevel zerolog.Level

LogLevel is a redefinition of zerolog.Level which satisfies encoding.TextUnmarshaler.

func (*LogLevel) UnmarshalText

func (l *LogLevel) UnmarshalText(text []byte) (err error)

UnmarshalText unmarshals the text to a LogLevel.

Jump to

Keyboard shortcuts

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