config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotReadFile  = ConfigErr("can not read config file")
	ErrNotUnmarshal = ConfigErr("can not unmarshal config data")
)

Variables

This section is empty.

Functions

func ConfigFile

func ConfigFile() string

func WriteConfigFile added in v0.2.0

func WriteConfigFile(filename string, data []byte) error

Types

type Config

type Config struct {
	AuthKey     string      `yaml:"auth_key"`
	DefaultLang DefaultLang `yaml:"default_lang"`
}

func LoadConfig

func LoadConfig() *Config

func ParseConfig

func ParseConfig(filepath string) (*Config, error)

func (*Config) DefaultLangs

func (c *Config) DefaultLangs() (string, string)

func (*Config) GetAuthKey added in v0.3.0

func (c *Config) GetAuthKey() string

func (*Config) Write added in v0.2.0

func (c *Config) Write() error

type ConfigErr

type ConfigErr string

func (ConfigErr) Error

func (c ConfigErr) Error() string

type DefaultLang

type DefaultLang struct {
	SourceLang string `yaml:"source_lang"`
	TargetLang string `yaml:"target_lang"`
}

Jump to

Keyboard shortcuts

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