forked from 1340691923/ElasticView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
40 lines (36 loc) · 902 Bytes
/
Copy pathconfig.go
File metadata and controls
40 lines (36 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//应用启动引擎层
package application
var GlobConfig Config
//全局配置结构体
type Config struct {
Log struct {
StorageDays int `json:"storageDays"`
LogDir string `json:"logDir"`
} `json:"log"`
Port int `json:"port"`
DbType string `json:"dbType"`
Sqlite struct {
DbPath string `json:"dbPath"`
} `json:"sqlite"`
Mysql struct {
Username string `json:"username"`
Pwd string `json:"pwd"`
IP string `json:"ip"`
Port string `json:"port"`
DbName string `json:"dbName"`
MaxOpenConns int `json:"maxOpenConns"`
MaxIdleConns int `json:"maxIdleConns"`
} `json:"mysql"`
AppSecret string `json:"appSecret"`
DeBug bool `json:"deBug"`
}
const (
MysqlDbTyp = "mysql"
SqliteDbTyp = "sqlite3"
)
func (this *Config) GetDbType() string {
if this.DbType == "mysql" {
return MysqlDbTyp
}
return SqliteDbTyp
}