config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAction

func ConfigAction(act func(*Model, *cli.Context) error) func(c *cli.Context)

func DatabaseAction

func DatabaseAction(act func(*gorm.DB, *cli.Context) error) func(c *cli.Context)

func ElasticAction

func ElasticAction(act func(*elastic.Client, *Model, *cli.Context) error) func(c *cli.Context)

func RedisAction

func RedisAction(act func(*redis.Pool, *cli.Context) error) func(c *cli.Context)

Types

type Database

type Database struct {
	Adapter  string            `toml:"adapter"`
	Host     string            `toml:"host"`
	Port     int               `toml:"port"`
	Name     string            `toml:"name"`
	User     string            `toml:"user"`
	Password string            `toml:"password"`
	Extra    map[string]string `toml:"extra"`
}

func (*Database) Console

func (p *Database) Console() (string, []string)

func (*Database) Execute

func (p *Database) Execute(sql string) (string, []string)

type ElasticSearch

type ElasticSearch struct {
	Host  string `toml:"host"`
	Port  int    `toml:"port"`
	Index string `toml:"index"`
}

func (*ElasticSearch) Url

func (p *ElasticSearch) Url() string

type Http

type Http struct {
	Domain string `toml:"domain"`
	Port   int    `toml:"port"`
	Ssl    bool   `toml:"ssl"`
}

type Model

type Model struct {
	Env           string         `toml:"-"`
	SecretsS      string         `toml:"secret"`
	Secrets       []byte         `toml:"-"`
	Http          *Http          `toml:"http"`
	Storage       *Storage       `toml:"storage"`
	Database      *Database      `toml:"database"`
	Redis         *Redis         `toml:"redis"`
	ElasticSearch *ElasticSearch `toml:"elastic_search"`
}

func Load

func Load(env string) (*Model, error)

func (*Model) AesCipher

func (p *Model) AesCipher() (cipher.Block, error)

func (*Model) Home

func (p *Model) Home() string

func (*Model) IsProduction

func (p *Model) IsProduction() bool

func (*Model) OpenDatabase

func (p *Model) OpenDatabase() (*gorm.DB, error)

func (*Model) OpenElastic

func (p *Model) OpenElastic() (*elastic.Client, error)

func (*Model) OpenRedis

func (p *Model) OpenRedis() *redis.Pool

func (*Model) OpenStorage

func (p *Model) OpenStorage() (storage.Provider, error)

type Redis

type Redis struct {
	Host string `toml:"host"`
	Port int    `toml:"port"`
	Db   int    `toml:"db"`
}

type Storage

type Storage struct {
	Type  string            `toml:"type"`
	Extra map[string]string `toml:"extra"`
}

Jump to

Keyboard shortcuts

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