config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 9 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneralCAHttpClient

func GeneralCAHttpClient() (*http.Client, error)

GeneralCAHttpClient returns an http.Client configured for general use

func GeneralCAHttpClientWithTimeout

func GeneralCAHttpClientWithTimeout(timeout time.Duration) (*http.Client, error)

GeneralCAHttpClientWithTimeout returns an http.Client configured for general use

func GetConfPath

func GetConfPath() string

GetConfPath get configuration file path

func GetConfPathDir

func GetConfPathDir() string

GetConfPathDir get configuration dir path

func GetDefaultConfPath

func GetDefaultConfPath() string

GetDefaultConfPath get default config file path

func GetEtcPath

func GetEtcPath() string

GetEtcPath returns the path to the etc directory

func GetGoPath

func GetGoPath() string

GetGoPath inspects the environment for the GOPATH variable

func ParseConfig

func ParseConfig(filePath string, conf interface{}, logger *zap.Logger) error

ParseConfig ...

Types

type BluemixConfig

type BluemixConfig struct {
	IamURL          string `toml:"iam_url"`
	IamClientID     string `toml:"iam_client_id"`
	IamClientSecret string `toml:"iam_client_secret" json:"-"`
	IamAPIKey       string `toml:"iam_api_key" json:"-"`
	RefreshToken    string `toml:"refresh_token" json:"-"`
	APIEndpointURL  string `toml:"containers_api_route"`
	Encryption      bool   `toml:"encryption"`
}

BluemixConfig ...

type Config

type Config struct {
	Server    *ServerConfig  `required:"true"`
	Bluemix   *BluemixConfig //`required:"true"`
	Softlayer *SoftlayerConfig
	Gen2      *Gen2Config
	VPC       *VPCProviderConfig
	IKS       *IKSConfig
}

Config is the parent struct for all the configuration information for -cluster

func ReadConfig

func ReadConfig(confPath string, logger *zap.Logger) (*Config, error)

ReadConfig loads the config from file

type Gen2Config

type Gen2Config struct {
	Gen2ProviderEnabled bool   `toml:"genesis_provider_enabled"`
	Gen2Username        string `toml:"genesis_user_name"`
	Gen2APIKey          string `toml:"genesis_api_key"`
	Gen2URL             string `toml:"genesis_url"`
}

Gen2Config ...

type IKSConfig

type IKSConfig struct {
	Enabled              bool   `toml:"iks_enabled" envconfig:"IKS_ENABLED"`
	IKSBlockProviderName string `toml:"iks_block_provider_name" envconfig:"IKS_BLOCK_PROVIDER_NAME"`
}

IKSConfig config

type ServerConfig

type ServerConfig struct {
	// DebugTrace is a flag to enable the debug level trace within the provider code.
	DebugTrace bool `toml:"debug_trace" envconfig:"DEBUG_TRACE"`
}

ServerConfig configuration options for the provider server itself

type SoftlayerConfig

type SoftlayerConfig struct {
	SoftlayerBlockEnabled        bool   `toml:"softlayer_block_enabled" envconfig:"SOFTLAYER_BLOCK_ENABLED"`
	SoftlayerBlockProviderName   string `toml:"softlayer_block_provider_name" envconfig:"SOFTLAYER_BLOCK_PROVIDER_NAME"`
	SoftlayerFileEnabled         bool   `toml:"softlayer_file_enabled" envconfig:"SOFTLAYER_FILE_ENABLED"`
	SoftlayerFileProviderName    string `toml:"softlayer_file_provider_name" envconfig:"SOFTLAYER_FILE_PROVIDER_NAME"`
	SoftlayerUsername            string `toml:"softlayer_username" json:"-"`
	SoftlayerAPIKey              string `toml:"softlayer_api_key" json:"-"`
	SoftlayerEndpointURL         string `toml:"softlayer_endpoint_url"`
	SoftlayerDataCenter          string `toml:"softlayer_datacenter"`
	SoftlayerTimeout             string `toml:"softlayer_api_timeout" envconfig:"SOFTLAYER_API_TIMEOUT"`
	SoftlayerVolProvisionTimeout string `toml:"softlayer_vol_provision_timeout" envconfig:"SOFTLAYER_VOL_PROVISION_TIMEOUT"`
	SoftlayerRetryInterval       string `toml:"softlayer_api_retry_interval" envconfig:"SOFTLAYER_API_RETRY_INTERVAL"`

	//Configuration values for JWT tokens
	SoftlayerJWTKID       string `toml:"softlayer_jwt_kid"`
	SoftlayerJWTTTL       int    `toml:"softlayer_jwt_ttl"`
	SoftlayerJWTValidFrom int    `toml:"softlayer_jwt_valid"`

	SoftlayerIMSEndpointURL string `toml:"softlayer_iam_endpoint_url"`
	SoftlayerAPIDebug       bool
}

SoftlayerConfig ...

type VPCProviderConfig

type VPCProviderConfig struct {
	Enabled              bool   `toml:"vpc_enabled" envconfig:"VPC_ENABLED"`
	VPCBlockProviderName string `toml:"vpc_block_provider_name" envconfig:"VPC_BLOCK_PROVIDER_NAME"`
	EndpointURL          string `toml:"gc_riaas_endpoint_url"`
	TokenExchangeURL     string `toml:"gc_token_exchange_endpoint_url"`
	APIKey               string `toml:"gc_api_key" json:"-"`
	Encryption           bool   `toml:"encryption"`
	ResourceGroupID      string `toml:"gc_resource_group_id"`
	Timeout              string `toml:"vpc_timeout,omitempty" envconfig:"VPC_TIMEOUT"`
	MaxRetryAttempt      int    `toml:"max_retry_attempt,omitempty" envconfig:"VPC_RETRY_ATTEMPT"`
	MaxRetryGap          int    `toml:"max_retry_gap,omitempty" envconfig:"VPC_RETRY_INTERVAL"`
	APIVersion           string `toml:"api_version,omitempty" envconfig:"VPC_API_VERSION"`
}

VPCProviderConfig configures a specific instance of a VPC provider (e.g. GT/GC/Z)

func (*VPCProviderConfig) GetTimeOutParameters

func (config *VPCProviderConfig) GetTimeOutParameters() (int, int, time.Duration)

GetTimeOutParameters retrives the parameteer to implement retry logic maxTimeout - Maximum time out for the operations retryGapDuration - The time interval for next attempt maxRetryAttempt - maxmum retry attempts derived based on maxTimeout and retryGapDuration

Jump to

Keyboard shortcuts

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