config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configured values for all parts of the application.

Configuration values are read from the file "config.json" in the initial directory of the running program. This means in particular that for test programs, the file "config.json" is searched in the package directory.

Index

Constants

This section is empty.

Variables

View Source
var Ok bool

Ok is true iff the configuration file has successfully been read. It may be false after init() has been called if no configuration file has been found.

Functions

func Int

func Int(key string) (ret int, err error)

Wrapper around Value to simplify retrieval of ints.

func IntOr

func IntOr(key string, byDefault int) (ret int, err error)

Wrapper around ValueOr to simplify retrieval of ints.

func String

func String(key string) (ret string, err error)

Wrapper around Value to simplify retrieval of strings.

func StringOr

func StringOr(key string, byDefault string) (ret string, err error)

Wrapper around ValueOr to simplify retrieval of strings.

func Value

func Value(key string, ret interface{}) (err error)

Retrieve the value associated to the given key. Same rules than with json.Unmarshal applies to ret.

func ValueOr

func ValueOr(key string, ret interface{}, byDefault interface{}) (err error)

Same as Value except that if the key is not found then byDefault is stored as the new value for that key, and returned. Same rules than with json.Marshal applies to byDefault.

Types

type KeyNotFound

type KeyNotFound string

Error returned when the key is not found in the configuration.

func (KeyNotFound) Error

func (self KeyNotFound) Error() string

Jump to

Keyboard shortcuts

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