conf

package
v0.0.0-...-b544e6b Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientsConfigFile

func GetClientsConfigFile() string

GetClientsConfigFile returns the path to the clients configuration file.

func GetResourceFile

func GetResourceFile(p ...string) string

GetResourceFile returns the path to a resource file using the global resource path. The path will be constructed from the resource path and all given path elements in p.

func GetStaticFilesDir

func GetStaticFilesDir() string

GetStaticFilesDir returns the path to the static files directory.

func InitLogEnv

func InitLogEnv()

InitLogEnv initializes loggers for access and error. Default access log directs to Stdout, default error log directs to Stderr. If log files are provided, the output will be directed to the respective default and the log file. Log files are opened using a logrotate compatible library.

func MakeTemplate

func MakeTemplate(name string) *template.Template

MakeTemplate loads a template using the default layout and the given content template file.

func MakeUrl

func MakeUrl(pathFormat string, param ...interface{}) string

MakeUrl makes a URL for other web resources provided by gin-auth using the base url from the server config file.

func SetResourcesPath

func SetResourcesPath(res string)

SetResourcesPath sets the resource path to the specified location. This function should only be used before other helpers from the conf package are used.

func SmtpCheck

func SmtpCheck() error

SmtpCheck tests whether a connection to the specified smtp server can be established with the provided credentials and will panic if it cannot.

Types

type DbConfig

type DbConfig struct {
	Driver string `yaml:"driver"`
	Open   string `yaml:"open"`
}

DbConfig contains data needed to connect to a SQL database. The struct contains yaml annotations in order to be compatible with gooses database configuration file (resources/conf/dbconf.yml)

func GetDbConfig

func GetDbConfig() *DbConfig

GetDbConfig loads a database configuration from a yaml file when called the first time. Returns a struct with configuration information.

type LogEnv

type LogEnv struct {
	Err    *logrus.Logger
	Access *logrus.Logger
	Close  func()
}

LogEnv provides the logging environment with error and access log and a function to defer closing any associated files.

func GetLogEnv

func GetLogEnv() *LogEnv

GetLogEnv initializes the global logger if required and returns it.

type LogLocations

type LogLocations struct {
	Access string
	Error  string
}

LogLocations contains paths to the Access and Error log files.

func GetLogLocation

func GetLogLocation() *LogLocations

GetLogLocation loads log file locations from a yaml file when called the first time. Returns a struct with the log file locations.

type ServerConfig

type ServerConfig struct {
	Host                  string
	Port                  int
	BaseURL               string
	SessionLifeTime       time.Duration
	TokenLifeTime         time.Duration
	GrantReqLifeTime      time.Duration
	UnusedAccountLifeTime time.Duration
	CleanerInterval       time.Duration
	MailQueueInterval     time.Duration
}

ServerConfig provides several general configuration parameters for gin-auth

func GetServerConfig

func GetServerConfig() *ServerConfig

GetServerConfig loads the server configuration from a yaml file when called the first time. Returns a struct with configuration information.

type SmtpCredentials

type SmtpCredentials struct {
	From     string
	Username string
	Password string
	Host     string
	Port     int
	Mode     string
}

SmtpCredentials contains the credentials required to send e-mails via smtp. Mode constitutes a switch whether e-mails should actually be sent or not. Supported values of Mode are: print and skip; print will write the content of any e-mail to the commandline / log, skip will skip over any e-mail sending process. For any other value of "Mode" e-mails will be sent.

func GetSmtpCredentials

func GetSmtpCredentials() *SmtpCredentials

GetSmtpCredentials loads the smtp access information from a yaml file when called the first time. Returns a struct with the smtp credentials.

Jump to

Keyboard shortcuts

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