config

package
v0.0.0-...-51a7f25 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package config is responsible for loading, parsing the configuration.

Index

Constants

View Source
const (
	// EnvPrefix is used as the prefix for Environment variable configuration.
	EnvPrefix = "APIM_BROKER"
	// FilePathEnv is used as a key to get the configuration file location.
	FilePathEnv = EnvPrefix + "_CONF_FILE"
	// FileType constant is used to specify the Configuration file type(YAML).
	FileType = "yaml"

	InfoMsgSettingUp        = "loading the configuration file: %s "
	ErrMsgUnableToReadConf  = "unable to read configuration: %s"
	ErrMsgUnableToParseConf = "unable to parse configuration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIM

type APIM struct {
	Username                         string `mapstructure:"username"`
	Password                         string `mapstructure:"password"`
	TokenEndpoint                    string `mapstructure:"tokenEndpoint"`
	DynamicClientEndpoint            string `mapstructure:"dynamicClientEndpoint"`
	DynamicClientRegistrationContext string `mapstructure:"dynamicClientRegistrationContext"`
	PublisherEndpoint                string `mapstructure:"publisherEndpoint"`
	PublisherAPIContext              string `mapstructure:"publisherAPIContext"`
	StoreApplicationContext          string `mapstructure:"storeApplicationContext"`
	StoreSubscriptionContext         string `mapstructure:"storeSubscriptionContext"`
	StoreMultipleSubscriptionContext string `mapstructure:"storeMultipleSubscriptionContext"`
	StoreEndpoint                    string `mapstructure:"storeEndpoint"`
}

APIM represents the information required to interact with the APIM.

type Auth

type Auth struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

Auth represents the username and the password for basic auth.

type Broker

type Broker struct {
	Log  Log  `mapstructure:"log"`
	HTTP HTTP `mapstructure:"http"`
	APIM APIM `mapstructure:"apim"`
	DB   DB   `mapstructure:"db"`
}

Broker main struct which holds sub configurations.

func Load

func Load() (*Broker, error)

Load loads configuration into Broker object. Returns a pointer to the created Broker object or any error encountered.

type Client

type Client struct {
	InsecureCon bool `mapstructure:"insecureCon"`
	Timeout     int  `mapstructure:"timeout"`
	MinBackOff  int  `mapstructure:"minBackOff"`
	MaxBackOff  int  `mapstructure:"maxBackOff"`
	MaxRetries  int  `mapstructure:"maxRetries"`
}

Client represents configuration needed for the HTTP client.

type DB

type DB struct {
	Host       string `mapstructure:"host"`
	Port       int    `mapstructure:"port"`
	Username   string `mapstructure:"username"`
	Password   string `mapstructure:"password"`
	Database   string `mapstructure:"database"`
	LogMode    bool   `mapstructure:"logMode"`
	MaxRetries int    `mapstructure:"maxRetries"`
}

DB represent the Database configuration.

type HTTP

type HTTP struct {
	Server Server `mapstructure:"server"`
	Client Client `mapstructure:"client"`
}

HTTP represents configuration needed for the HTTP server and client.

type Log

type Log struct {
	FilePath string `mapstructure:"filePath"`
	Level    string `mapstructure:"level"`
}

Log represents the configuration related to logging.

type Server

type Server struct {
	Auth Auth   `mapstructure:"auth"`
	TLS  TLS    `mapstructure:"tls"`
	Host string `mapstructure:"host"`
	Port string `mapstructure:"port"`
}

Server represents configuration needed for the HTTP server.

type TLS

type TLS struct {
	Enabled bool   `mapstructure:"enabled"`
	Key     string `mapstructure:"key"`
	Cert    string `mapstructure:"cert"`
}

TLS represents configuration needed for HTTPS.

Jump to

Keyboard shortcuts

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