config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GlobalFlags `mapstructure:",squash"`
	LocalFlags  `mapstructure:",squash"`
	FileConfig  *viper.Viper `mapstructure:"-" json:"-" yaml:"-" `
	// contains filtered or unexported fields
}

func New

func New() *Config

func (*Config) GetTargets

func (c *Config) GetTargets() (map[string]*TargetConfig, error)

func (*Config) Load

func (c *Config) Load() error

func (*Config) LogOutput

func (c *Config) LogOutput() io.Writer

func (*Config) SetLocalFlagsFromFile

func (c *Config) SetLocalFlagsFromFile(cmd *cobra.Command)

func (*Config) SetLogger

func (c *Config) SetLogger()

func (*Config) SetPersistentFlagsFromFile

func (c *Config) SetPersistentFlagsFromFile(cmd *cobra.Command)

type GlobalFlags

type GlobalFlags struct {
	CfgFile       string
	Address       []string      `mapstructure:"address,omitempty" json:"address,omitempty" yaml:"address,omitempty"`
	Username      string        `mapstructure:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty"`
	Password      string        `mapstructure:"password,omitempty" json:"password,omitempty" yaml:"password,omitempty"`
	Port          string        `mapstructure:"port,omitempty" json:"port,omitempty" yaml:"port,omitempty"`
	Encoding      string        `mapstructure:"encoding,omitempty" json:"encoding,omitempty" yaml:"encoding,omitempty"`
	Insecure      bool          `mapstructure:"insecure,omitempty" json:"insecure,omitempty" yaml:"insecure,omitempty"`
	TLSCa         string        `mapstructure:"tls-ca,omitempty" json:"tls-ca,omitempty" yaml:"tls-ca,omitempty"`
	TLSCert       string        `mapstructure:"tls-cert,omitempty" json:"tls-cert,omitempty" yaml:"tls-cert,omitempty"`
	TLSKey        string        `mapstructure:"tls-key,omitempty" json:"tls-key,omitempty" yaml:"tls-key,omitempty"`
	TLSMinVersion string        `mapstructure:"tls-min-version,omitempty" json:"tls-min-version,omitempty" yaml:"tls-min-version,omitempty"`
	TLSMaxVersion string        `mapstructure:"tls-max-version,omitempty" json:"tls-max-version,omitempty" yaml:"tls-max-version,omitempty"`
	TLSVersion    string        `mapstructure:"tls-version,omitempty" json:"tls-version,omitempty" yaml:"tls-version,omitempty"`
	LogTLSSecret  bool          `mapstructure:"log-tls-secret,omitempty" json:"log-tls-secret,omitempty" yaml:"log-tls-secret,omitempty"`
	Timeout       time.Duration `mapstructure:"timeout,omitempty" json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Debug         bool          `mapstructure:"debug,omitempty" json:"debug,omitempty" yaml:"debug,omitempty"`
	SkipVerify    bool          `mapstructure:"skip-verify,omitempty" json:"skip-verify,omitempty" yaml:"skip-verify,omitempty"`
	ProxyFromEnv  bool          `mapstructure:"proxy-from-env,omitempty" json:"proxy-from-env,omitempty" yaml:"proxy-from-env,omitempty"`
	Format        string        `mapstructure:"format,omitempty" json:"format,omitempty" yaml:"format,omitempty"`
	LogFile       string        `mapstructure:"log-file,omitempty" json:"log-file,omitempty" yaml:"log-file,omitempty"`
	Log           bool          `mapstructure:"log,omitempty" json:"log,omitempty" yaml:"log,omitempty"`
	MaxMsgSize    int           `mapstructure:"max-msg-size,omitempty" json:"max-msg-size,omitempty" yaml:"max-msg-size,omitempty"`
	PrintRequest  bool          `mapstructure:"print-request,omitempty" json:"print-request,omitempty" yaml:"print-request,omitempty"`
	Retry         time.Duration `mapstructure:"retry,omitempty" json:"retry,omitempty" yaml:"retry,omitempty"`
	PrintProto    bool          `mapstructure:"print-proto,omitempty" json:"print-proto,omitempty" yaml:"print-proto,omitempty"`
	Gzip          bool          `mapstructure:"gzip,omitempty" json:"gzip,omitempty" yaml:"gzip,omitempty"`
}

type LocalFlags

type LocalFlags struct {
	// Authz
	// AuthzProbe
	AuthzProbeUser string
	AuthzProbeRPC  string
	// AuthzRotate
	AuthzRotateForceOverwrite bool
	AuthzRotateVersion        string
	AuthzRotateCreatedOn      string
	AuthzRotatePolicy         string
	AuthzRotateFinalizeAfter  time.Duration

	// Pathz
	// PathzProbe
	PathzProbeUser string
	PathzProbeRPC  string
	// PathzRotate
	PathzRotateForceOverwrite bool
	PathzRotateVersion        string
	PathzRotateCreatedOn      string
	PathzRotatePolicy         string
	PathzRotateFinalizeAfter  time.Duration

	// Certz
	// Certz Info
	CertzInfoCertificate string
	// Certz CreateCa
	CertzCreateCaOrg           string
	CertzCreateCaOrgUnit       string
	CertzCreateCaCountry       string
	CertzCreateCaState         string
	CertzCreateCaLocality      string
	CertzCreateCaStreetAddress string
	CertzCreateCaPostalCode    string
	CertzCreateCaValidity      time.Duration
	CertzCreateCaKeySize       int
	CertzCreateCaEmailID       string
	CertzCreateCaCommonName    string
	CertzCreateCaKeyOut        string
	CertzCreateCaCertOut       string

	// Certz Rotate
	CertzRotateCertificateValidity time.Duration
	CertzRotateCACert              string
	CertzRotateCAKey               string
	CertzRotateForceOverwrite      bool
	CertzRotateSSLProfileID        string
	// Certz Rotate GenCSR
	CertzRotateCSRSuite   string
	CertzRotateCommonName string
	CertzRotateCountry    string
	CertzRotateState      string
	CertzRotateCity       string
	CertzRotateOrg        string
	CertzRotateOrgUnit    string
	CertzRotateIPAddress  string
	CertzRotateEmailID    string
	CertzRotateSanDNS     []string
	CertzRotateSanEmail   []string
	CertzRotateSanIP      []string
	CertzRotateSanURI     []string
	// Certz Rotate Upload
	// Certz Rotate Upload Entities
	CertzRotateEntityCreatedOn []string
	// Certz Rotate Upload Entity Cert Chain
	CertzRotateEntityCertChainCertificateVersion  string
	CertzRotateEntityCertChainCertificateType     []string
	CertzRotateEntityCertChainCertificateEncoding []string
	CertzRotateEntityCertChainCertificateCFile    []string
	CertzRotateEntityCertChainCertificateKFile    []string
	// Certz Rotate Upload Entity Trust Bundle
	CertzRotateEntityCertChainTrustBundleVersion  []string
	CertzRotateEntityCertChainTrustBundleType     []string
	CertzRotateEntityCertChainTrustBundleEncoding []string
	CertzRotateEntityCertChainTrustBundleCFile    []string
	// Certz Rotate Upload Entity CRL
	CertzRotateEntityCertChainCRLVersion  []string
	CertzRotateEntityCertChainCRLType     []string
	CertzRotateEntityCertChainCRLEncoding []string
	CertzRotateEntityCertChainCRLCFile    []string
	CertzRotateEntityCertChainCRLID       []string
	// Certz Rotate Upload Entity AuthPolicy
	CertzRotateEntityAuthPolicy string

	// Certz Add Profile
	CertzAddProfileID string
	// Certz delete Profile
	CertzDeleteProfileID string
	// Certz CanGenerateCSR
	CertzCanGenCSRCSRSuite   string
	CertzCanGenCSRCommonName string
	CertzCanGenCSRCountry    string
	CertzCanGenCSRState      string
	CertzCanGenCSRCity       string
	CertzCanGenCSROrg        string
	CertzCanGenCSROrgUnit    string
	CertzCanGenCSRIPAddress  string
	CertzCanGenCSREmailID    string
	CertzCanGenCSRSanDNS     []string
	CertzCanGenCSRSanEmail   []string
	CertzCanGenCSRSanIP      []string
	CertzCanGenCSRSanURI     []string
}

type TargetConfig

type TargetConfig struct {
	Name          string        `json:"name,omitempty" mapstructure:"name,omitempty"`
	Address       string        `json:"address,omitempty" mapstructure:"address,omitempty"`
	Insecure      *bool         `json:"insecure,omitempty" mapstructure:"insecure,omitempty"`
	SkipVerify    *bool         `json:"skip-verify,omitempty" mapstructure:"skip-verify,omitempty"`
	Username      *string       `json:"username,omitempty" mapstructure:"username,omitempty"`
	Password      *string       `json:"password,omitempty" mapstructure:"password,omitempty"`
	Timeout       time.Duration `json:"timeout,omitempty" mapstructure:"timeout,omitempty"`
	TLSCert       *string       `json:"tls-cert,omitempty" mapstructure:"tls-cert,omitempty"`
	TLSKey        *string       `json:"tls-key,omitempty" mapstructure:"tls-key,omitempty"`
	TLSCA         *string       `json:"tlsca,omitempty" mapstructure:"tlsca,omitempty"`
	TLSMinVersion string        `json:"tls-min-version,omitempty" mapstructure:"tls-min-version,omitempty"`
	TLSMaxVersion string        `json:"tls-max-version,omitempty" mapstructure:"tls-max-version,omitempty"`
	TLSVersion    string        `json:"tls-version,omitempty" mapstructure:"tls-version,omitempty"`
	Gzip          *bool         `json:"gzip,omitempty" mapstructure:"gzip,omitempty"`
	//
	CommonName string `json:"common-name,omitempty"`
	ResolvedIP string `json:"resolved-ip,omitempty"`
	// contains filtered or unexported fields
}

func (*TargetConfig) DialOpts

func (tc *TargetConfig) DialOpts() ([]grpc.DialOption, error)

func (*TargetConfig) SetTLSConfig added in v0.0.2

func (tc *TargetConfig) SetTLSConfig(tlsConfig *tls.Config)

func (*TargetConfig) String

func (tc *TargetConfig) String() string

Jump to

Keyboard shortcuts

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