config

package
v0.0.0-...-6f746f0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2020 License: GPL-3.0 Imports: 4 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 {
	Host          string `mapstructure:"HOST"`
	Port          int    `mapstructure:"PORT"`
	ChannelSecret string `mapstructure:"CHANNEL_SECRET"`
	ChannelToken  string `mapstructure:"CHANNEL_TOKEN"`
}

Config is configuration data used by application

func ReadConfig

func ReadConfig(reader Reader) (*Config, error)

ReadConfig read configuration file and return Config value

type EnvReader

type EnvReader struct {
	EnvFiles []string
	// contains filtered or unexported fields
}

EnvReader is implementation of ConfigReader which read env

func (*EnvReader) Decode

func (r *EnvReader) Decode() (*Config, error)

Decode uses mapstructure to change env to ConfigData and return Config

func (*EnvReader) Read

func (r *EnvReader) Read() (err error)

Read utilizes godotenv Read to read the environment

type Reader

type Reader interface {
	Read() error
	Decode() (*Config, error)
}

Reader is interface for global application config

Jump to

Keyboard shortcuts

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