utils

package
v0.0.0-...-ac565ea Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2015 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Additional utils

Index

Constants

This section is empty.

Variables

View Source
var (
	LoggerError *log.Logger = log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile)
	LoggerDebug *log.Logger = log.New(ioutil.Discard, "DEBUG: ", log.Ldate|log.Lmicroseconds|log.Lshortfile)
)

Functions

func EmailToAdmin

func EmailToAdmin(cfg *Config, subject, msg string) error

func FilePath

func FilePath(name string) (string, error)

It Validates file name, converts it from relative to absolute.

func LoggerInit

func LoggerInit(debugmode bool)

Initialization of Logger handlers

func SendEmail

func SendEmail(cfg *Config, to []string, subject, msg string) error

Send HTML email

Types

type Config

type Config struct {
	DbDatabase    string `json:"database"`
	DbUser        string `json:"dbuser"`
	DbPassword    string `json:"dbpassword"`
	DbPort        uint   `json:"dbport"`
	EmailUser     string `json:"email_user"`
	EmailPassword string `json:"email_password"`
	EmailHost     string `json:"email_host"`
	EmailAddr     string `json:"email_addr"`
	EmailAdmin    string `json:"email_admin"`
	Templates     string `json:"templates"`
	Static        string `json:"static"`
}

func GetConfig

func GetConfig(name *string) Config

Parse config file from JSON format.

type SimpleEmail

type SimpleEmail struct {
	Name string
	Msg  string
}

Jump to

Keyboard shortcuts

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