config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause

Index

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

func RemoveSystemConfig(name string) error

RemoveSystemConfig removes system config settings. If the system being removed was the default connection, default is set to nothing.

func SetDefault

func SetDefault(name string) error

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.

Jump to

Keyboard shortcuts

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