config

package
v0.0.0-...-0fa8ac3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// Address is the socket to bind to
	Address string `mapstructure:"address"`

	LogLevel string `mapstructure:"log_level"`

	AllowOrigins []string `mapstructure:"allow_origins"`

	// TLSConfig holds various TLS related configurations
	TLSConfig *TLSConfig `mapstructure:"-"`

	JwtConfig *JwtConfig `mapstructure:"-"`

	SchedulerConfig *SchedulerConfig `mapstructure:"-"`

	DriverConfig *DriverConfig `mapstructure:"-"`

	PostgresConfig *PostgresConfig `mapstructure:"-"`
}

Config is what defines the behaviour of the api

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func ParseConfig

func ParseConfig(r io.Reader) (*Config, error)

ParseConfig parses the config from the given io.Reader.

Due to current internal limitations, the entire contents of the io.Reader will be copied into memory first before parsing.

func ParseConfigFile

func ParseConfigFile(path string) (*Config, error)

ParseConfigFile parses the given path as a config file.

type DriverConfig

type DriverConfig struct {
	// Enable specifies the name of drivers to enable
	Enable []string `mapstructure:"enable"`

	// Options provides arbitrary key-value configuration for internals,
	// like authentication and drivers. The format is:
	//
	//	namespace.option = value
	Options DriverOptions `mapstructure:"options"`
}

func DefaultDriverConfig

func DefaultDriverConfig() *DriverConfig

type DriverOptions

type DriverOptions map[string]string

type JwtConfig

type JwtConfig struct {
	Secret string `mapstructure:"secret"`
}

type PostgresConfig

type PostgresConfig struct {
	Address  string `mapstructure:"address"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
}

func (*PostgresConfig) Connect

func (p *PostgresConfig) Connect() *pg.DB

Connect creates a new pg connection

type SchedulerConfig

type SchedulerConfig struct {
	Name string `mapstructure:"name"`
}

type TLSConfig

type TLSConfig struct {
	Enable bool
	Auto   bool
	Cert   string
	Key    string
}

TLSConfig holds various TLS related configurations

Jump to

Keyboard shortcuts

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