config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormatJSON will be used to indicate a JSON file
	FormatJSON = uint(2)
	// FormatText will be used to indicate a text file, or when an unknown mimetype is found
	FormatText = uint(1)
	// FormatUnknown will be used to indicate a problem
	FormatUnknown = uint(0)
)

Variables

View Source
var (

	/*
		The following support overrides during builds, which can be done
		by setting ldflags, e.g.

		`-ldflags "-X github.com/cezmunsta/ssh_ms/config.EnvSSHUserName=xxx"`

	*/
	// EnvBasePath is the parent location used to prefix storage paths
	EnvBasePath = filepath.Join(os.Getenv("HOME"), ".ssh", "cache")

	// EnvSSHDefaultUsername sets the default used in connections
	EnvSSHDefaultUsername = os.Getenv("USER")

	// EnvSSHUsername is used to authenticate with SSH
	EnvSSHUsername = "SSH_MS_USERNAME"

	// EnvSSHIdentityFile is used for SSH authentication
	EnvSSHIdentityFile = filepath.Join("~", ".ssh", "id_ed25519")
)

Functions

func GetFileType

func GetFileType(fh *os.File) (uint, error)

GetFileType will return the mimetype of a file fh : file handle

Types

type Settings

type Settings struct {
	LogLevel                                       logrus.Level
	Debug, Simulate, StoredToken, Verbose, Version bool
	ConfigComment, EnvSSHDefaultUsername, EnvSSHIdentityFile,
	EnvSSHUsername, Show, StoragePath, User, VaultAddr, VaultToken string
}

Settings contains the configuration details

func GetConfig

func GetConfig() *Settings

GetConfig returns an instance of Settings ensuring that only one instance is ever returned

func (*Settings) ToJSON

func (s *Settings) ToJSON() string

ToJSON returns the config in JSON format

Jump to

Keyboard shortcuts

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