misc

package
v0.0.0-...-1a139e7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2015 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package misc provides miscellaneous structs and methods used by the application.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Logger is a accessible logger, providing formatted log messages with different output levels
	Logger *factorlog.FactorLog
)

Functions

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString returns a random alphanumerical string with the given length

func SetupLogger

func SetupLogger(debugLevel int)

SetupLogger configures the logger, setting a custom format and output level

Types

type Configuration

type Configuration struct {
	// DatabaseType represents the database type to be used as a backend
	DatabaseType int
	// DatabaseHost represents the hostname:port of the database backend
	DatabaseHost string
	// DatabaseSchema represents the schema/collection of the database backend
	DatabaseSchema string
	// DatabaseUser represents the username used to authenticate with the database backend
	DatabaseUser string
	// DatabasePassword represents the password used to authenticate with the database backend
	DatabasePassword string
	// RedisHost represents the hostname:port of the Redis data store
	RedisHost string
	// RedisPassword represents the password used to authenticate with the Redis data store
	RedisPassword string
	// DebugLevel represents the debug level for log messages
	DebugLevel int
	// DebugTemplates toggles the reloading of all templates for every request
	DebugTemplates bool
	// HTTPHost represents the hostname:port the application should listen to for requests
	HTTPHost string
	// TaxPercentage represents the percentage of tax taken per loot paste
	TaxPercentage int
	// TaxReportCode represents the access code for the taxes report
	TaxReportCode string
}

Configuration stores all configuration values required by the application

func LoadConfig

func LoadConfig() (*Configuration, error)

LoadConfig creates a Configuration by either using commandline flags or a configuration file, returning an error if the parsing failed

func ParseCommandlineFlags

func ParseCommandlineFlags(config *Configuration) *Configuration

ParseCommandlineFlags parses the command line flags used with the application

func ParseJSONConfig

func ParseJSONConfig(path string) (*Configuration, error)

ParseJSONConfig parses a Configuration from a JSON encoded file, returning an error if the process failed

Jump to

Keyboard shortcuts

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