config

package
v0.0.0-...-71395a5 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CollSMSTemplate = "sms_template"
	CollSMSCategory = "sms_category"
)

Variables

View Source
var (
	ErrTemplateNotFound     = errors.New("template not found")
	ErrCategoryNotFound     = errors.New("category not found")
	ErrTemplateNotAvailable = errors.New("template not available")

	//短信类别
	LoadedCategories = make(map[t.Category]t.SMSCategory)
	//短信通道
	LoadedChannels = make(map[t.Category]t.Channel)
	//短信模版
	LoadedTemplates = make(map[t.Name]t.SMSTemplate)
)

Functions

func Init

func Init()

Load configuration

func RegisterLoader

func RegisterLoader(configLoader ConfigLoader)

func RegisterWatcher

func RegisterWatcher(w Watcher)

func WhichCategory

func WhichCategory(name t.Category) (*t.SMSCategory, error)

func WhichChannel

func WhichChannel(name t.Category) (t.Channel, error)

WhichChannel returns a channel for given category

func WhichTemplate

func WhichTemplate(name t.Name) (*t.SMSTemplate, error)

WhichTemplate returns the enabled template for given name

Types

type ConfigLoader

type ConfigLoader interface {
	LoadCategory() []t.SMSCategory
	LoadTemplate() []t.SMSTemplate
}

type SMSConfig

type SMSConfig struct {
	Username  string
	Password  string
	Endpoints []string
}

type Watcher

type Watcher interface {
	Watch(c chan int64)
}

Jump to

Keyboard shortcuts

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