env

package
v1.63.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 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

Index

Constants

View Source
const (
	// SiteModeNormal serves app
	SiteModeNormal = ""
	// SiteModeOffline serves offline.html
	SiteModeOffline = "1"
	// SiteModeSetup tells Ember to serve setup route
	SiteModeSetup = "2"
	// SiteModeBadDB redirects to db-error.html page
	SiteModeBadDB = "3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbVariant added in v1.51.0

type DbVariant string

DbVariant details SQL database variant

const (
	// DbVariantMySQL is MySQL
	DbVariantMySQL DbVariant = "MySQL"
	// DBVariantPercona is Percona
	DBVariantPercona DbVariant = "Percona"
	// DBVariantMariaDB is MariaDB
	DBVariantMariaDB DbVariant = "MariaDB"
	// DBVariantMSSQL is Microsoft SQL Server
	DBVariantMSSQL DbVariant = "MSSQL"
	// DBVariantPostgreSQL is PostgreSQL
	DBVariantPostgreSQL DbVariant = "PostgreSQL"
)

type Flags

type Flags struct {
	DBConn            string // database connection string
	Salt              string // the salt string used to encode JWT tokens
	DBType            string // (optional) database type
	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) IsValid added in v1.51.0

func (l *License) IsValid() bool

IsValid returns if license is valid

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)
	Trace(message string)
	Error(message string, err error)
}

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
	DbVariant DbVariant
	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