config

package
v0.0.0-...-e7b3743 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingDatabaseURL is returned if no database connection URL is set in config
	ErrMissingDatabaseURL = errors.New("Database URL is missing")
	// ErrMissingSecretKey is returned if no secret key  is set in config
	ErrMissingSecretKey = errors.New("Secret key is missing")
)

Functions

func RandomKey

func RandomKey() string

RandomKey generates a printable, random 32 byte string

Types

type Config

type Config struct {
	Mail             *MailConfig
	Port             int
	MaxDBConnections int
	Env,
	DatabaseURL,
	StaticURL,
	DynamicContentURL,
	TemplateDir,
	StaticDir,
	GoogleAnalyticsID,
	SecureCookieKey,
	SecretKey string
}

Config is server configuration

func Default

func Default() *Config

Default returns a ready-made configuration with sensible settings

func (*Config) IsDev

func (cfg *Config) IsDev() bool

IsDev checks if configuration is set to development mode

func (*Config) IsProd

func (cfg *Config) IsProd() bool

IsProd checks if configuration is set to production mode

func (*Config) MustValidate

func (cfg *Config) MustValidate()

MustValidate checks that all required configuration settings are present and correct

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks that all required configuration settings are present and correct

type MailConfig

type MailConfig struct {
	TemplateDir,
	Addr,
	ID,
	User,
	Password,
	Host string
}

MailConfig contains SMTP settings

Directories

Path Synopsis
Godeps
_workspace/src/github.com/gorilla/securecookie
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.

Jump to

Keyboard shortcuts

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