config

package
v0.0.0-...-4fe0d4a Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigFromFile

func LoadConfigFromFile(configPath string) (err error)

LoadConfigFromFile load json configuration file from configPath to given struct

Types

type Config

type Config struct {
	Name        string         `json:"name"`
	Version     string         `json:"version"`
	Description string         `json:"description"`
	DB          *DBConfig      `json:"db"`
	HTTP        *HTTPConfig    `json:"http"`
	Upstream    UpstreamConfig `json:"upstream"`
}

Config all config container

func Get

func Get() *Config

Get returns config container pointer

type DBConfig

type DBConfig struct {
	Postgres map[string]*PostgresConfig `json:"postgres"`
}

DBConfig database config container

type HTTPConfig

type HTTPConfig struct {
	Listen string `json:"listen"`
	Port   string `json:"port"`
}

HTTPConfig http config

type HTTPUpstreamConfig

type HTTPUpstreamConfig struct {
	Address string `json:"address"`
	Port    string `json:"port"`
	Schema  string `json:"schema"`
}

HTTPUpstreamConfig http upstream config

func (*HTTPUpstreamConfig) GetURL

func (hcfg *HTTPUpstreamConfig) GetURL() string

GetURL gets from http upstream connection string

type PostgresConfig

type PostgresConfig struct {
	Database string `json:"database"`
	Host     string `json:"host"`
	User     string `json:"user"`
	Password string `json:"password"`
	SSLMode  string `json:"sslmode"`
}

PostgresConfig postgress config

func (*PostgresConfig) GetURL

func (pCfg *PostgresConfig) GetURL() string

GetURL gets dssn connection string

type SocketConfig

type SocketConfig struct {
	Address string `json:"address"`
	Port    string `json:"port"`
}

SocketConfig tcp / udp upstream config

func (*SocketConfig) GetTarget

func (scfg *SocketConfig) GetTarget() string

GetTarget gets target address from upstream

type UnixSocketConfig

type UnixSocketConfig struct {
	FileDescriptor string `json:"fileDescriptor"`
}

UnixSocketConfig unix socket config

type UpstreamConfig

type UpstreamConfig struct {
	HTTP       map[string]*HTTPUpstreamConfig `json:"http"`
	UnixSocket map[string]UnixSocketConfig    `json:"unixSocket"`
	Socket     map[string]*SocketConfig       `json:"socket"`
}

UpstreamConfig container

Jump to

Keyboard shortcuts

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