config

package
v0.0.0-...-9ce0fb8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGetEnv

func MustGetEnv(key string) string

MustGetEnv gather environment variable and convert it to an int value. Panics if it fail

func MustGetEnvInt

func MustGetEnvInt(key string) int

MustGetEnvInt gather environment variable and convert it to an int value. Panics if it fail

Types

type Config

type Config interface {
	GetHost() string
	GetPort() string
	GetClientHost() string
	GetClientPort() string
	GetLogLevel() int
}

Config represents a Gabble Server configuration

type EnvConfig

type EnvConfig struct {
	// contains filtered or unexported fields
}

EnvConfig satisfies Gabble server configuration from a .env file

func FromEnvFile

func FromEnvFile() (*EnvConfig, error)

FromEnvFile reads configuration from a .env file located in the CWD and returns a EnvConfig

func (*EnvConfig) GetClientHost

func (conf *EnvConfig) GetClientHost() string

GetClientHost returns the "SERVER_PORT" value from the .env file

func (*EnvConfig) GetClientPort

func (conf *EnvConfig) GetClientPort() string

GetClientPort returns the "SERVER_PORT" value from the .env file

func (*EnvConfig) GetHost

func (conf *EnvConfig) GetHost() string

GetHost returns the "SERVER_HOST" value from the .env file

func (*EnvConfig) GetLogLevel

func (conf *EnvConfig) GetLogLevel() int

GetLogLevel returns the "LOG_LEVEL" value from the .env file

func (*EnvConfig) GetPort

func (conf *EnvConfig) GetPort() string

GetPort returns the "SERVER_PORT" value from the .env file

type OSEnvConfig

type OSEnvConfig struct {
	// contains filtered or unexported fields
}

OSEnvConfig satisfies Gabble server configuration from OS environment variables

func FromOsEnv

func FromOsEnv() (*OSEnvConfig, error)

FromOsEnv reads configuration from the OS environment variables

func (*OSEnvConfig) GetClientHost

func (conf *OSEnvConfig) GetClientHost() string

GetClientHost returns the "SERVER_PORT" value from the .env file

func (*OSEnvConfig) GetClientPort

func (conf *OSEnvConfig) GetClientPort() string

GetClientPort returns the "SERVER_PORT" value from the .env file

func (*OSEnvConfig) GetHost

func (conf *OSEnvConfig) GetHost() string

GetHost returns the "SERVER_HOST" value from the .env file

func (*OSEnvConfig) GetLogLevel

func (conf *OSEnvConfig) GetLogLevel() int

GetLogLevel returns the "LOG_LEVEL" value from the .env file

func (*OSEnvConfig) GetPort

func (conf *OSEnvConfig) GetPort() string

GetPort returns the "SERVER_PORT" value from the .env file

Jump to

Keyboard shortcuts

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