env

package
v1.50.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2017 License: AGPL-3.0 Imports: 8 Imported by: 154

Documentation

Overview

Package env provides runtime, server level setup and configuration

Package env provides runtime, server level setup and configuration

Package env provides runtime, server level setup and configuration

Package env provides runtime, server level setup and configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flags

type Flags struct {
	DBConn            string // database connection string
	Salt              string // the salt string used to encode JWT tokens
	SSLCertFile       string // (optional) name of SSL certificate PEM file
	SSLKeyFile        string // (optional) name of SSL key PEM file
	HTTPPort          string // (optional) HTTP or HTTPS port
	ForceHTTPPort2SSL string // (optional) HTTP that should be redirected to HTTPS
	SiteMode          string // (optional) if 1 then serve offline web page
}

Flags provides access to environment and command line switches for this program.

func ParseFlags

func ParseFlags() (f Flags)

ParseFlags loads command line and OS environment variables required by the program to function.

func (*Flags) SSLEnabled

func (f *Flags) SSLEnabled() bool

SSLEnabled returns true if both cert and key were provided at runtime.

type License

type License struct {
	Name    string    `json:"name"`
	Email   string    `json:"email"`
	Edition string    `json:"edition"`
	Start   time.Time `json:"start"`
	End     time.Time `json:"end"`
	Seats   int       `json:"seats"`
	Trial   bool      `json:"trial"`
	Valid   bool
}

License holds details of product license.

func (*License) IsEmpty

func (l *License) IsEmpty() bool

IsEmpty determines if we have a license.

func (*License) Status

func (l *License) Status() string

Status returns formatted message stating if license is empty/populated and invalid/valid.

type LicenseData

type LicenseData struct {
	Key       string `json:"key"`
	Signature string `json:"signature"`
}

LicenseData holds encrypted data and is unpacked into License.

type Logger

type Logger interface {
	Info(message string)
	Error(message string, err error)
	SetDB(l Logger, db *sqlx.DB) Logger
}

Logger provides the interface for Documize compatible loggers.

type ProdInfo

type ProdInfo struct {
	Edition string
	Title   string
	Version string
	Major   string
	Minor   string
	Patch   string
	License License
}

ProdInfo describes a product

type Runtime

type Runtime struct {
	Flags   Flags
	Db      *sqlx.DB
	Log     Logger
	Product ProdInfo
}

Runtime provides access to database, logger and other server-level scoped objects. Use Context for per-request values.

Jump to

Keyboard shortcuts

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