config

package
v0.0.0-...-9e8b3cb Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(path string) error

读取配置文件

Types

type AppConfig

type AppConfig struct {
	ApiHost    string `json:"api_host"`    //api请求host
	DomainName string `json:"domain_name"` //域名
	Version    string `json:"version"`     //版本
}

type Config

type Config struct {
	PrivateKeyPath  string          `json:"private_key_path"`
	PublicKeyPath   string          `json:"public_key_path"`
	LogPath         string          `json:"log_path"`
	LocalFilePath   string          `json:"local_file_path"`
	Port            string          `json:"port"` //httpServer
	StaticPath      string          `json:"static_path"`
	DBConfig        DBConfig        `json:"db_config"`         //数据库配置
	MonitorDBConfig MonitorDBConfig `json:"monitor_db_config"` //日志数据库配置

	RouterPrefix string     `json:"router_prefix"` //api前缀
	AuthPrefix   string     `json:"auth_prefix"`   //白名单
	MailConfig   MailConfig `json:"mail_config"`   //邮箱
	AppConfig    AppConfig  `json:"app_config"`
}

func Conf

func Conf() *Config

func (*Config) Parse

func (c *Config) Parse(path string) error

解析配置文件

type DBConfig

type DBConfig struct {
	Url       string `json:"url"`        //连接地址
	DBName    string `json:"db_name"`    //数据库名
	ForceSync bool   `json:"force_sync"` //强制索引同步
}

数据库配置结构体

type MailConfig

type MailConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*MailConfig) Dialer

func (c *MailConfig) Dialer() (*gomail.Dialer, error)

type MonitorDBConfig

type MonitorDBConfig struct {
	Url    string `json:"url"`     //连接地址
	DBName string `json:"db_name"` //数据库名
}

数据库配置结构体

Jump to

Keyboard shortcuts

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