conf

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(cfg interface{}) error

LoadConfig loads configuration from provided file and serializes it into RpConfig struct

Types

type ConsulConfig

type ConsulConfig struct {
	Address      string   `env:"RP_CONSUL_ADDRESS" envDefault:"registry:8500"`
	Scheme       string   `env:"RP_CONSUL_SCHEME" envDefault:"http"`
	Token        string   `env:"RP_CONSUL_TOKEN"`
	PollInterval int      `env:"RP_CONSUL_POLL_INTERVAL" envDefault:"5"`
	Tags         []string `env:"RP_CONSUL_TAGS"`
}

ConsulConfig represents Consul Discovery service configuration

func (*ConsulConfig) AddTags

func (c *ConsulConfig) AddTags(tags ...string)

AddTags parses tags to string array. Extremely slow implementation - simplicity over speed

type Registry

type Registry string

Registry represents type of used service discovery server

const (
	//Consul service discovery
	Consul Registry = "consul"
)

type RpConfig

type RpConfig struct {
	AppName  string   `env:"RP_APP_NAME" envDefault:"goRP"`
	Registry Registry `env:"RP_REGISTRY" envDefault:"consul"`
	Server   *ServerConfig
	Consul   *ConsulConfig
}

RpConfig represents Composite of all app configs

func EmptyConfig

func EmptyConfig() *RpConfig

EmptyConfig creates empty config

type ServerConfig

type ServerConfig struct {
	Hostname string `env:"HOSTNAME" envDefault:"localhost"`
	Port     int    `env:"RP_SERVER_PORT" envDefault:"8080"`
}

ServerConfig represents Main service configuration

Jump to

Keyboard shortcuts

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