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 ¶
const (
ConfigFileDefault = "/etc/ccl.toml" // ConfigFileDefault is default configuration file path
)
Variables ¶
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 ¶
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
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 ¶
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
UnionNetworks is like Union but for Networks, and also no mask.