Documentation ¶
Overview ¶
SPDX-License-Identifier: BSD-3-Clause
Index ¶
- func AddSystemConfig(name string, sysConfig *SystemConfig, makeDefault bool) error
- func GetDefault() string
- func GetSystems() map[string]SystemConfig
- func InitConfig(cfgFile string)
- func IsDefault(system *SystemConfig) bool
- func RemoveSystemConfig(name string) error
- func SetDefault(name string) error
- type Config
- type SystemConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSystemConfig ¶
func AddSystemConfig(name string, sysConfig *SystemConfig, makeDefault bool) error
AddSystemConfig adds or updates system config settings. If system already exists it will be overwritten with the new settings.
func GetDefault ¶
func GetDefault() string
GetDefault returns the name of the system to be used as the default connection.
func GetSystems ¶
func GetSystems() map[string]SystemConfig
GetSystems gets all configured system settings.
func InitConfig ¶
func InitConfig(cfgFile string)
InitConfig reads in config file and ENV variables if set.
func IsDefault ¶
func IsDefault(system *SystemConfig) bool
IsDefault checks if a system is the current default
func RemoveSystemConfig ¶
RemoveSystemConfig removes system config settings. If the system being removed was the default connection, default is set to nothing.
func SetDefault ¶
SetDefault will set the default system to use if not explicitly provided.
Types ¶
type Config ¶
type Config struct { Default string `yaml:"default"` Systems map[string]SystemConfig `yaml:"systems"` }
Config is the configuration settings we use.
type SystemConfig ¶
type SystemConfig struct { Host string `yaml:"host"` Port uint16 `yaml:"port"` Protocol string `yaml:"protocol"` Username string `yaml:"username"` Password string `yaml:"password"` Secure bool `yaml:"secure"` }
SystemConfig is the config settings for our systems.
func GetDefaultSystem ¶
func GetDefaultSystem() *SystemConfig
GetDefaultSystem gets the config settings for the system set as the default.
func GetSystem ¶
func GetSystem(name string) *SystemConfig
GetSystem gets the config settings for the system with the given host name.