Documentation ¶
Overview ¶
Package config implements shared configuration-related routines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Debug *log.Logger
Functions ¶
func Load ¶
Load loads the config struct with values stored in the given file. The file's encoding is JSON.
In addition, depending on environment details, a second file is loaded over network. The remote file overrides those settings of the local file which have been marked as dynamic in the corresponding struct field. To mark field as dynamic, tag it with config=dynamic, for example:
RelayHost string `config:"dynamic"`
The server path must be a valid HTTP path except the order of query parameters is significant. The path may include the template action {{.Hostname}} which expands to local host name, for example:
"/tsp/forwarder?host={{.Hostname}}"
The test for config=dynamic tag is not performed recursively.
At least one path must be provided. If a path is empty, it is ignored.
Types ¶
type Directory ¶
type Directory struct { C <-chan DirectoryEvent // contains filtered or unexported fields }
Directory is a watcher of directory changes.
func WatchDirectory ¶
WatchDirectory watches the given directory for updates. The scan is not recursive.
type DirectoryEvent ¶
DirectoryEvent represents addition/removal event of the given file.
func (DirectoryEvent) String ¶
func (event DirectoryEvent) String() string