config

package
v0.0.0-...-df00f50 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppLibAbsPath string

Functions

func DefaultLoadFromYaml

func DefaultLoadFromYaml(configDirPath string, appConfig *AppConfig)

func LoadFromYaml

func LoadFromYaml(filePath string)

Types

type AppConfig

type AppConfig struct {
	Addr          string             `yaml:"addr"`        // 监听端口
	Pulic         StaticConfig       `yaml:"public"`      // 静态资源路径
	Secret        string             `yaml:"secret"`      // 用于系统加密的秘钥
	ViewBaseDir   string             `yaml:"viewBaseDir"` // view路径
	Dblist        map[string]DbConfg `yaml:"dblist"`      // 数据库连接列表
	AppLibAbsPath string             // ginapp所在的绝对路径
	SessionCnf    SessionConfig      `yaml:"session"` // session配置
}

* app配置

type DbConfg

type DbConfg struct {
	Type string `yaml:"type"` // 数据库类型,如:mysql
	Dsn  string `yaml:"dsn"`  // 数据库连接
}

type SessionConfig

type SessionConfig struct {
	Type       string            `yaml:"type"`   // 数据库类型,如:redis
	ConnectCnf map[string]string `yaml:"config"` // 配置信息
}

type StaticConfig

type StaticConfig struct {
	RelativePath string `yaml:"relativePath"`
	Root         string `yaml:"root"`
}

* 静态资源配置

Jump to

Keyboard shortcuts

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