config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvKeyZpeConfigPath the environment variable key for ZPE config path
	EnvKeyZpeConfigPath = "ZPE_CONFIG_PATH"
	// EnvKeyAthenzConfigPath the environment variable key for Athenz server config path
	EnvKeyAthenzConfigPath = "ATHENZ_CONFIG_PATH"
	// EnvKeyZpuConfigPath the environment variable key for ZPU config path
	EnvKeyZpuConfigPath = "ZPU_CONFIG_PATH"
	// EnvKeyAgentConfigPath the environment variable key for agent config path
	EnvKeyAgentConfigPath = "AGENT_CONFIG_PATH"

	// DefaultZpeConfigPath the default value ZPE config
	DefaultZpeConfigPath = "config/zpe.conf"
	// DefaultAthenzConfigPath the default value for Athenz config
	DefaultAthenzConfigPath = "config/athenz.conf"
	// DefaultZpuConfigPath the default value for ZPU config
	DefaultZpuConfigPath = "config/zpu.conf"
	// DefaultAgentConfigPath the default value for agent config
	DefaultAgentConfigPath = "config/agent.json"
)
View Source
const (
	LogFile = "agent.out"
	LogDir  = "logs"
)

Variables

View Source
var (
	KeyStore  = newAthenzConfiguration()
	ZpeConfig = newZpeConfiguration()
)
View Source
var (
	AgentConfig = newAgentConfiguration()
)
View Source
var (
	ZpuConfig = new(ZpuConfiguration)
)

Functions

func LoadAgentConfig

func LoadAgentConfig(agentConfig *AgentConfiguration, filePath string) error

LoadAgentConfig reads config file from a specific address and loads it into a AgentConfiguration object

func LoadAthenzConfig

func LoadAthenzConfig(athenzConfig *AthenzConfiguration, filePath string) error

LoadAthenzConfig reads config file from a specific address and loads it into a AthenzConfiguration object.

func LoadGlobalAgentConfig

func LoadGlobalAgentConfig(filePath string) error

LoadGlobalAgentConfig loads config file from input path into the global variable AgentConfig.

func LoadGlobalAthenzConfig

func LoadGlobalAthenzConfig(filePath string) error

LoadGlobalAthenzConfig loads config file from input path into the global variable KeyStore.

func LoadGlobalZpeConfig

func LoadGlobalZpeConfig(filePath string) error

LoadGlobalZpeConfig loads config file from input path into the global variable ZpeConfig.

func LoadGlobalZpuConfig

func LoadGlobalZpuConfig(athenzConfPath, zpuConfPath string) error

LoadGlobalZpuConfig loads config file from input path into the global variable ZpuConfig.

func LoadZpeConfig

func LoadZpeConfig(zpeConfig *ZpeConfiguration, filePath string) error

LoadZpeConfig reads config file from a specific address and loads it into a ZpeConfiguration object

func LoadZpuConfig

func LoadZpuConfig(zpuConfig *ZpuConfiguration, athenzConfPath, zpuConfPath string) error

LoadZpuConfig reads config file from a specific address and loads it into a ZpuConfiguration object.

Types

type AgentConfiguration

type AgentConfiguration struct {
	Properties *agentProperties
	// contains filtered or unexported fields
}

type AthenzConfiguration

type AthenzConfiguration struct {
	Properties *athenzProperties
	// contains filtered or unexported fields
}

func (AthenzConfiguration) GetZmsPublicKey

func (config AthenzConfiguration) GetZmsPublicKey(id string) string

func (AthenzConfiguration) GetZtsPublicKey

func (config AthenzConfiguration) GetZtsPublicKey(id string) string

type Loader

type Loader interface {
	// LoadConfig loads config file from filePath ro config object
	LoadConfig(config interface{}, filePath string) error
	// WithDefaultConfig performs default configuration to config loader
	WithDefaultConfig()
}

Loader is the interface that wraps the basic config loader.

func NewConfigLoader

func NewConfigLoader() Loader

NewConfigLoader creates new instance of Leader type

type MtlsProperties

type MtlsProperties struct {
	CaPath         string `mapstructure:"ca_path"`
	CrtPath        string `mapstructure:"crt_path"`
	PrivateKeyPath string `mapstructure:"key_path"`
}

func (MtlsProperties) IsEmpty

func (p MtlsProperties) IsEmpty() bool

IsEmpty checks if MtlsProperties has value or not. If not returns true else returns false.

type Properties

type Properties struct {
	ZpeConfigFile    string `mapstructure:"zpe_config_file"`
	ZpuConfigFile    string `mapstructure:"zpu_config_file"`
	AthenzConfigFile string `mapstructure:"athenz_config_file"`
}

type PublicKeys

type PublicKeys struct {
	Id  string
	Key string
}

type ServerProperties

type ServerProperties struct {
	Name string
	Port string
	MtlsProperties
}

type ZpeConfiguration

type ZpeConfiguration struct {
	Properties *zpeProperties
	// contains filtered or unexported fields
}

type ZpuConfiguration

type ZpuConfiguration struct {
	// Yahoo zpu configuration
	Properties *zpu.ZpuConfiguration
}

Jump to

Keyboard shortcuts

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