config

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppURLKey          = "app.url"
	AppVersionKey      = "app.version"
	DBPrefixKey        = "db.prefix"
	DBUserKey          = "db.user"
	DBPasswordKey      = "db.password"
	DBHostKey          = "db.host"
	DBPortKey          = "db.port"
	DBNameKey          = "db.name"
	DBTimeoutKey       = "db.timeout"
	LogDebugKey        = "log.debug"
	LogFormatKey       = "log.format"
	ServerPortKey      = "server.port"
	ServerTimeoutKey   = "server.timeout"
	ShortLinkAPIKey    = "shortlink.apikey"
	ShortLinkDomainKey = "shortlink.domain"
)

Setting keys

View Source
const (
	AppURLEnv          = "APP_URL"
	DBPrefixEnv        = "DB_PREFIX"
	DBUserEnv          = "DB_USER"
	DBPasswordEnv      = "DB_PASSWORD"
	DBHostEnv          = "DB_HOST"
	DBPortEnv          = "DB_PORT"
	DBNameEnv          = "DB_NAME"
	DBTimeoutEnv       = "DB_TIMEOUT"
	LogDebugEnv        = "LOG_DEBUG"
	LogFormatEnv       = "LOG_FORMAT"
	ServerPortEnv      = "SERVER_PORT"
	ServerTimeoutEnv   = "SERVER_TIMEOUT"
	ShortLinkAPIEnv    = "SHORTLINK_APIKEY"
	ShortLinkDomainEnv = "SHORTLINK_DOMAIN"
)

Environment variables

View Source
const AppName = "docuhost"

AppName represents the name of the application

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	App struct {
		URL     string `mapstructure:"url"`
		Version string `mapstructure:"version"`
	} `mapstructure:"app"`
	DB struct {
		Prefix   string `mapstructure:"prefix"`
		User     string `mapstructure:"user"`
		Password string `mapstructure:"password"`
		Host     string `mapstructure:"host"`
		Port     int64  `mapstructure:"port"`
		Name     string `mapstructure:"name"`
		Timeout  int64  `mapstructure:"timeout"`
	} `mapstructure:"db"`
	Server struct {
		Port    string `mapstructure:"port"`
		Timeout int64  `mapstructure:"timeout"`
	} `mapstructure:"server"`
	Log struct {
		Debug  bool   `mapstructure:"debug"`
		Format string `mapstructure:"format"`
	} `mapstructure:"log"`
	ShortLink struct {
		APIKey string `mapstructure:"apiKey"`
		Domain string `mapstructure:"domain"`
	} `mapstructure:"shortlink"`
}

Configuration represents the application configuration settings

func (Configuration) PrettyPrint

func (c Configuration) PrettyPrint()

PrettyPrint outputs a formatted listing of the configuration settings

func (Configuration) String

func (c Configuration) String() string

String displays the configuration settings

type VersionInfo added in v0.2.1

type VersionInfo struct {
	Version  string `mapstructure:"version"`
	Revision string `mapstructure:"revision"`
}

VersionInfo represents the application's latest version tag and Git revision

func AppVersion added in v0.2.1

func AppVersion() VersionInfo

AppVersion returns the application's latest version and Git revision

func (VersionInfo) String added in v0.3.0

func (v VersionInfo) String() string

String returns a formatted form of the version and revision

Jump to

Keyboard shortcuts

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