config

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config is used manage initialize and house the main program data structures, as well as marshalling the configuration to and from toml.

Copyright © 2022 Joel D. Elkins <joel@elkins.co>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	ConfigFileDefault = "/etc/ccl.toml" // ConfigFileDefault is default configuration file path
)

Variables

View Source
var (
	ConfigFile = ConfigFileDefault        // ConfigFile is the path to the configuration file to use in a particular invocation.
	Networks   = []*network.Network{}     // Networks is the program-global set of congiured network.Networks structures
	Containers = []*container.Container{} // Containers is the program-global set of configured container.Container structures.
	Options    = new(GlobalOptions)       // Options contains global options, mostly pertaining to dns updates now
)

Functions

func Categories

func Categories() []string

Categories returns a slice of all of the distinct categories found in the configured containers.

func Init

func Init(conn context.Context) error

Init will parse the configuration file, create and populate the in-memory data structures. Will call container.Init() on each container created in this way.

func Show added in v1.1.5

func Show(ids []string, contMask []string) string

Show will output a toml configuration of the provided identifiers ("all", category, or container name). The resulting string would presumably be sent to the terminal or a file.

Other than ordering of fields and possible inclusion of some fields with their default values, the generated toml should be completely compatible with the actual configuration. Dogfood safe.

func Union

func Union(ids []string, catMask []string) (conts []*container.Container)

Union - given a list of identifiers ("all", a category, or a container name), as well as a category mask, will yieLd a list of configured containers that match the identifiers but not the mask. As envisioned, the default mask would be ".", i.e., the tool would normally exclude containers "disabled" by setting their category to a string with a leading period (e.g. ".hidden")

func UnionNetworks added in v1.1.5

func UnionNetworks(ids []string) []*network.Network

UnionNetworks is like Union but for Networks, and also no mask.

Types

type GlobalOptions added in v1.2.90

type GlobalOptions struct {
	DNSServer  string `toml:"dns_server,omitempty"`
	TSIGName   string `toml:"tsig_name,omitempty"`
	TSIGKey    string `toml:"tsig_key,omitempty"`
	DomainName string `toml:"domain_name,omitempty"`
}

Jump to

Keyboard shortcuts

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