Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
gin-vue-admin
提交
0985c1fb
G
gin-vue-admin
项目概览
飞鱼0526
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0985c1fb
编写于
4月 05, 2020
作者:
G
Granty1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Migrating configuration files from json to yaml
上级
a0570c05
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
96 addition
and
91 deletion
+96
-91
server/config.json
server/config.json
+0
-43
server/config.yaml
server/config.yaml
+51
-0
server/config/config.go
server/config/config.go
+40
-44
server/core/config.go
server/core/config.go
+5
-4
未找到文件。
server/config.json
已删除
100644 → 0
浏览文件 @
a0570c05
{
"casbin"
:
{
"modelPath"
:
"./resource/rbac_model.conf"
},
"jwt"
:
{
"signingKey"
:
"qmPlus"
},
"mysql"
:
{
"username"
:
"root"
,
"password"
:
"Aa@6447985"
,
"path"
:
"127.0.0.1:3306"
,
"dbname"
:
"qmPlus"
,
"config"
:
"charset=utf8
\u
0026parseTime=True
\u
0026loc=Local"
,
"maxIdleConns"
:
10
,
"maxOpenConns"
:
100
,
"logMode"
:
true
},
"qiniu"
:
{
"accessKey"
:
"25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ"
,
"secretKey"
:
"pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY"
},
"redis"
:
{
"addr"
:
"127.0.0.1:6379"
,
"password"
:
""
,
"db"
:
0
},
"system"
:
{
"useMultipoint"
:
false
,
"env"
:
"develop"
,
"addr"
:
8888
},
"captcha"
:
{
"keyLong"
:
6
,
"imgWidth"
:
120
,
"imgHeight"
:
40
},
"log"
:
{
"prefix"
:
"[GIN-VUE-ADMIN]"
,
"logFile"
:
false
,
"stdout"
:
"DEBUG"
,
"file"
:
"WARNING"
}
}
\ No newline at end of file
server/config.yaml
0 → 100644
浏览文件 @
0985c1fb
# Gin-Vue-Admin Global Configuration
# casbin configuration
casbin
:
model-path
:
'
./resource/rbac_model.conf'
# jwt configuration
jwt
:
signing-key
:
'
qmPlus'
# mysql connect configuration
mysql
:
username
:
root
#Aa@6447985
password
:
'
YINGL19980716.'
path
:
'
127.0.0.1:3306'
db-name
:
'
qmPlus'
config
:
'
charset=utf8&parseTime=True&loc=Local'
max-idle-conns
:
10
max-open-conns
:
10
log-mode
:
true
# oss configuration
qiniu
:
access-key
:
'
25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
secret-key
:
'
pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
# redis configuration
redis
:
addr
:
'
127.0.0.1:6379'
passwprd
:
'
'
db
:
0
# system configuration
system
:
use-multipoint
:
false
env
:
'
develop'
addr
:
8888
# captcha configuration
captcha
:
key-long
:
6
img-width
:
120
img-height
:
40
# logger configuration
log
:
prefix
:
'
[GIN-VUE-ADMIN]'
log-file
:
true
stdout
:
'
DEBUG'
file
:
'
WARNING'
server/config/config.go
浏览文件 @
0985c1fb
package
config
type
Server
struct
{
Mysql
Mysql
`json
:"mysql"`
Qiniu
Qiniu
`json
:"qiniu"`
Casbin
Casbin
`json
:"casbin"`
Redis
Redis
`json
:"redis"`
System
System
`json
:"system"`
JWT
JWT
`json
:"jwt"`
Captcha
Captcha
`json
:"captcha"`
Log
Log
`json
:"log"`
Mysql
`mapstructure
:"mysql"`
Qiniu
`mapstructure
:"qiniu"`
Casbin
`mapstructure
:"casbin"`
Redis
`mapstructure
:"redis"`
System
`mapstructure
:"system"`
JWT
`mapstructure
:"jwt"`
Captcha
`mapstructure
:"captcha"`
Log
`mapstructure
:"log"`
}
type
System
struct
{
// 系统配置
UseMultipoint
bool
`
json:"useM
ultipoint"`
Env
string
`
json
:"env"`
Addr
int
`
json
:"addr"`
type
System
struct
{
UseMultipoint
bool
`
mapstructure:"use-m
ultipoint"`
Env
string
`
mapstructure
:"env"`
Addr
int
`
mapstructure
:"addr"`
}
type
JWT
struct
{
// jwt签名
SigningKey
string
`
json:"signingK
ey"`
type
JWT
struct
{
SigningKey
string
`
mapstructure:"signing-k
ey"`
}
type
Casbin
struct
{
//casbin配置
ModelPath
string
`
json:"modelPath"`
// casbin model地址配置
type
Casbin
struct
{
ModelPath
string
`
mapstructure:"model-path"`
}
type
Mysql
struct
{
// mysql admin 数据库配置
Username
string
`
json
:"username"`
Password
string
`
json
:"password"`
Path
string
`
json
:"path"`
Dbname
string
`
json:"db
name"`
Config
string
`
json
:"config"`
MaxIdleConns
int
`
json:"maxIdleC
onns"`
MaxOpenConns
int
`
json:"maxOpenC
onns"`
LogMode
bool
`
json:"maxOpenConns
"`
type
Mysql
struct
{
Username
string
`
mapstructure
:"username"`
Password
string
`
mapstructure
:"password"`
Path
string
`
mapstructure
:"path"`
Dbname
string
`
mapstructure:"db-
name"`
Config
string
`
mapstructure
:"config"`
MaxIdleConns
int
`
mapstructure:"max-idle-c
onns"`
MaxOpenConns
int
`
mapstructure:"max-open-c
onns"`
LogMode
bool
`
mapstructure:"log-mode
"`
}
type
Redis
struct
{
// Redis admin 数据库配置
Addr
string
`
json
:"addr"`
Password
string
`
json
:"password"`
DB
int
`
json
:"db"`
type
Redis
struct
{
Addr
string
`
mapstructure
:"addr"`
Password
string
`
mapstructure
:"password"`
DB
int
`
mapstructure
:"db"`
}
type
Qiniu
struct
{
// 七牛 密钥配置
AccessKey
string
`
json:"accessK
ey"`
SecretKey
string
`
json:"secretK
ey"`
type
Qiniu
struct
{
AccessKey
string
`
mapstructure:"access-k
ey"`
SecretKey
string
`
mapstructure:"secret-k
ey"`
}
type
Captcha
struct
{
// 验证码配置
KeyLong
int
`
json:"keyL
ong"`
ImgWidth
int
`
json:"imgW
idth"`
ImgHeight
int
`
json:"imgH
eight"`
type
Captcha
struct
{
KeyLong
int
`
mapstructure:"key-l
ong"`
ImgWidth
int
`
mapstructure:"img-w
idth"`
ImgHeight
int
`
mapstructure:"img-h
eight"`
}
type
Log
struct
{
// log 打印的前缀
Prefix
string
`json:"prefix"`
// 是否显示打印log的文件具体路径
LogFile
bool
`json:"logFile"`
// 在控制台打印log的级别, "" 默认不打印
Stdout
string
`json:"stdout"`
// 在文件中打印log的级别 "" 默认不打印
File
string
`json:"file"`
Prefix
string
`mapstructure:"prefix"`
LogFile
bool
`mapstructure:"log-file"`
Stdout
string
`mapstructure:"stdout"`
File
string
`mapstructure:"file"`
}
server/core/config.go
浏览文件 @
0985c1fb
...
...
@@ -7,16 +7,17 @@ import (
"github.com/spf13/viper"
)
const
defaultConfigFile
=
"config.yaml"
func
init
()
{
v
:=
viper
.
New
()
v
.
SetConfigName
(
"config"
)
// 设置配置文件名 (不带后缀)
v
.
AddConfigPath
(
"./"
)
// 第一个搜索路径
v
.
SetConfigType
(
"json"
)
err
:=
v
.
ReadInConfig
()
// 搜索路径,并读取配置数据
v
.
SetConfigFile
(
defaultConfigFile
)
err
:=
v
.
ReadInConfig
()
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Fatal error config file: %s
\n
"
,
err
))
}
v
.
WatchConfig
()
v
.
OnConfigChange
(
func
(
e
fsnotify
.
Event
)
{
fmt
.
Println
(
"config file changed:"
,
e
.
Name
)
if
err
:=
v
.
Unmarshal
(
&
global
.
GVA_CONFIG
);
err
!=
nil
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录