config

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config contains logic for reading dpcmder configuration from commandline parameters, reading and writting configuration to dpcmder JSON configuration file and showing command line usage / help.

Index

Constants

View Source
const (
	DpInterfaceSoma    = "SOMA"
	DpInterfaceRest    = "REST"
	DpInterfaceUnknown = "Unknown"
)

List of DataPower management interfaces - returned by DpManagmentInterface().

View Source
const (

	// PreviousApplianceName is name of configuration for the last appliance
	// configured with command-line parameters (without explicitly saving config).
	PreviousApplianceName = "_PreviousAppliance_"
)

Variables

View Source
var (
	// LocalFolderPath is a folder where dpcmder starts showing files - set by command flag.
	LocalFolderPath *string
	// DebugLogFile/TraceLogFile enables writing of debug/trace messages to
	// dpcmder.log file in current folder.
	DebugLogFile *bool
	TraceLogFile *bool
)

DataPower Commander command line parameters.

View Source
var Conf = Config{
	Cmd: Command{
		Viewer: "less", Editor: "vi", Diff: "diff"},
	Log:                 Log{MaxEntrySize: logging.MaxEntrySize},
	Sync:                Sync{Seconds: 4},
	DataPowerAppliances: make(map[string]DataPowerAppliance)}

Conf variable contains all configuration parameters for dpcmder. Here are default configuration values which will be merged with values read from JSON configuration file (if configuration file is found).

View Source
var CurrentApplianceName string

CurrentApplianceName stores configuration of current appliance name used.

View Source
var DpTransientPasswordMap = make(map[string]string)

DpTransientPasswordMap contains passwords entered through dpcmder dialogs, not saved to config during (other) configuration changes.

Functions

func Init

func Init()

Init intializes configuration: parses command line flags and creates config directory.

func LogConfig added in v0.2.0

func LogConfig()

LogConfig logs configuration values to log file.

func PrintConfig

func PrintConfig()

PrintConfig prints configuration values to console.

Types

type Command

type Command struct {
	Viewer string
	Editor string
	Diff   string
}

Command is a structure containing dpcmder external command configuration.

type Config

type Config struct {
	Cmd                 Command
	Log                 Log
	Sync                Sync
	DataPowerAppliances map[string]DataPowerAppliance
}

Config is a structure containing dpcmder configuration (saved to JSON).

func (*Config) CreateDpApplianceConfig added in v0.3.0

func (c *Config) CreateDpApplianceConfig() ([]byte, error)

CreateDpApplianceConfig creates empty DataPower appliance JSON configuration as byte array.

func (*Config) DeleteDpApplianceConfig added in v0.2.1

func (c *Config) DeleteDpApplianceConfig(name string)

DeleteDpApplianceConfig deletes DataPower appliance JSON configuration.

func (*Config) GetDpApplianceConfig added in v0.1.0

func (c *Config) GetDpApplianceConfig(name string) ([]byte, error)

GetDpApplianceConfig fetches DataPower appliance JSON configuration as byte array.

func (*Config) SetDpApplianceConfig added in v0.2.0

func (c *Config) SetDpApplianceConfig(name string, contents []byte) error

SetDpApplianceConfig sets DataPower appliance JSON configuration as byte array.

type DataPowerAppliance added in v0.1.0

type DataPowerAppliance struct {
	RestUrl  string
	SomaUrl  string
	Username string
	Password string
	Domain   string
	Proxy    string
}

DataPowerAppliance is a structure containing dpcmder DataPower appliance configuration details required to connect to appliances.

var CurrentAppliance DataPowerAppliance

CurrentAppliance stores configuration value of current appliance used.

func (*DataPowerAppliance) DpManagmentInterface added in v0.3.0

func (dpa *DataPowerAppliance) DpManagmentInterface() string

DpManagmentInterface returns management interface used to manage DataPower.

func (*DataPowerAppliance) DpPlaintextPassword added in v0.2.0

func (dpa *DataPowerAppliance) DpPlaintextPassword() string

DpPlaintextPassword fetches decoded password from DataPowerAppliance struct.

func (*DataPowerAppliance) SetDpPlaintextPassword added in v0.2.0

func (dpa *DataPowerAppliance) SetDpPlaintextPassword(password string)

SetDpPlaintextPassword sets encoded Password field on DataPowerAppliance from plaintext password.

type Log

type Log struct {
	MaxEntrySize int
}

Log is a structure containing dpcmder logging configuration. MaxEntrySize configures how many bytes can each log line contain (rest is removed).

type Sync

type Sync struct {
	Seconds int
}

Sync is a structure containing dpcmder synchronization configuration used when syncing local filesystem to datapower is enabled.

Jump to

Keyboard shortcuts

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