config

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package config defines Config interface and generate method.

Index

Constants

View Source
const (
	// Timeout is the max execution time of external command.
	Timeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Engines is a map of engine name and engine executable path pairs.
	// This map must not be empty. If empty, panics when called New method.
	//
	// The key is the name of shogi engine. Any string is OK to use.
	// The value is the path of shogi engine.
	// It must be executable, and work with USI protocol.
	//
	// TODO: write document about USI protocol
	Engines map[string]string `yaml:"engines"`

	// Keys of Engines
	EngineNames []string `yaml:"engineNames"`
}

App is configuration of application

type Config

type Config struct {
	// application config
	App App

	// zap(logger) config
	Log zap.Config
}

Config is container of configurations.

func New

func New(appPath, logPath string) *Config

New returns new Config.

The appPath is a path to application config file. See /config/app.example.yml. The logPath is a path to logger(zap) config file. See /config/log.yml

Only YAML syntax is supported for now. TODO: support JSON and TOML

Jump to

Keyboard shortcuts

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