Compare commits
1 Commits
cfbe751af7
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 46d326638b |
57
.env.example
Normal file
57
.env.example
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# 应用配置
|
||||||
|
RUN_MODE=development
|
||||||
|
DEBUG_HTTP_DUMP=false
|
||||||
|
|
||||||
|
# 数据库配置
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_NAME=app
|
||||||
|
DB_USERNAME=dev
|
||||||
|
DB_PASSWORD=dev
|
||||||
|
|
||||||
|
# redis 配置
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
# otel 配置
|
||||||
|
OTEL_HOST=127.0.0.1
|
||||||
|
OTEL_PORT=4317
|
||||||
|
|
||||||
|
# 白银节点
|
||||||
|
BAIYIN_CLOUD_URL=
|
||||||
|
BAIYIN_TOKEN_URL=
|
||||||
|
|
||||||
|
# 京东实名
|
||||||
|
IDEN_ACCESS_KEY=
|
||||||
|
IDEN_SECRET_KEY=
|
||||||
|
IDEN_CALLBACK_URL=
|
||||||
|
|
||||||
|
# 支付宝(暂时弃用,但是需要配置)
|
||||||
|
ALIPAY_APP_ID=
|
||||||
|
ALIPAY_APP_PRIVATE_KEY=
|
||||||
|
ALIPAY_PUBLIC_KEY=
|
||||||
|
ALIPAY_API_CERT=
|
||||||
|
|
||||||
|
# 微信支付(暂时弃用,但是需要配置)
|
||||||
|
WECHATPAY_APP_ID=
|
||||||
|
WECHATPAY_MCH_ID=
|
||||||
|
WECHATPAY_MCH_PRIVATE_KEY_SERIAL=
|
||||||
|
WECHATPAY_MCH_PRIVATE_KEY=
|
||||||
|
WECHATPAY_PUBLIC_KEY_ID=
|
||||||
|
WECHATPAY_PUBLIC_KEY=
|
||||||
|
WECHATPAY_API_CERT=
|
||||||
|
WECHATPAY_CALLBACK_URL=
|
||||||
|
|
||||||
|
# 阿里云
|
||||||
|
ALIYUN_ACCESS_KEY=
|
||||||
|
ALIYUN_ACCESS_KEY_SECRET=
|
||||||
|
ALIYUN_SMS_SIGNATURE=
|
||||||
|
ALIYUN_SMS_TEMPLATE_LOGIN=
|
||||||
|
|
||||||
|
# 商福通
|
||||||
|
SFTPAY_ENABLE=
|
||||||
|
SFTPAY_APP_ID=
|
||||||
|
SFTPAY_ROUTE_ID=
|
||||||
|
SFTPAY_APP_PRIVATE_KEY=
|
||||||
|
SFTPAY_PUBLIC_KEY=
|
||||||
|
SFTPAY_RETURN_URL=
|
||||||
2
pkg/env/env.go
vendored
2
pkg/env/env.go
vendored
@@ -24,7 +24,6 @@ var (
|
|||||||
SessionAccessExpire = 60 * 60 * 2 // 访问令牌过期时间,单位秒。默认 2 小时
|
SessionAccessExpire = 60 * 60 * 2 // 访问令牌过期时间,单位秒。默认 2 小时
|
||||||
SessionRefreshExpire = 60 * 60 * 24 * 7 // 刷新令牌过期时间,单位秒。默认 7 天
|
SessionRefreshExpire = 60 * 60 * 24 * 7 // 刷新令牌过期时间,单位秒。默认 7 天
|
||||||
DebugHttpDump = false // 是否打印请求和响应的原始数据
|
DebugHttpDump = false // 是否打印请求和响应的原始数据
|
||||||
DebugExternalChange = true // 是否实际执行外部非幂等接口调用,在开发调试时可以关闭,避免对外部数据产生影响
|
|
||||||
|
|
||||||
DbHost = "localhost"
|
DbHost = "localhost"
|
||||||
DbPort = "5432"
|
DbPort = "5432"
|
||||||
@@ -106,7 +105,6 @@ func Init() {
|
|||||||
errs = append(errs, parse(&SessionAccessExpire, "SESSION_ACCESS_EXPIRE", true, nil))
|
errs = append(errs, parse(&SessionAccessExpire, "SESSION_ACCESS_EXPIRE", true, nil))
|
||||||
errs = append(errs, parse(&SessionRefreshExpire, "SESSION_REFRESH_EXPIRE", true, nil))
|
errs = append(errs, parse(&SessionRefreshExpire, "SESSION_REFRESH_EXPIRE", true, nil))
|
||||||
errs = append(errs, parse(&DebugHttpDump, "DEBUG_HTTP_DUMP", true, nil))
|
errs = append(errs, parse(&DebugHttpDump, "DEBUG_HTTP_DUMP", true, nil))
|
||||||
errs = append(errs, parse(&DebugExternalChange, "DEBUG_EXTERNAL_CHANGE", true, nil))
|
|
||||||
|
|
||||||
errs = append(errs, parse(&DbHost, "DB_HOST", true, nil))
|
errs = append(errs, parse(&DbHost, "DB_HOST", true, nil))
|
||||||
errs = append(errs, parse(&DbPort, "DB_PORT", true, nil))
|
errs = append(errs, parse(&DbPort, "DB_PORT", true, nil))
|
||||||
|
|||||||
@@ -1,10 +1,20 @@
|
|||||||
-- ====================
|
-- ====================
|
||||||
-- region 填充数据
|
-- region 客户端
|
||||||
-- ====================
|
-- ====================
|
||||||
|
|
||||||
insert into client (type, spec, name, client_id, client_secret, redirect_uri) values (1, 3, 'web', 'web', '$2a$10$Ss12mXQgpYyo1CKIZ3URouDm.Lc2KcYJzsvEK2PTIXlv6fHQht45a', '');
|
insert into client (type, spec, name, client_id, client_secret, redirect_uri) values (1, 3, 'web', 'web', '$2a$10$Ss12mXQgpYyo1CKIZ3URouDm.Lc2KcYJzsvEK2PTIXlv6fHQht45a', '');
|
||||||
insert into client (type, spec, name, client_id, client_secret, redirect_uri) values (1, 3, 'admin', 'admin', '$2a$10$dlfvX5Uf3iVsUWgwlb0Wt.oYsw/OEXgS.Aior3yoT63Ju7ZSsJr/2', '');
|
insert into client (type, spec, name, client_id, client_secret, redirect_uri) values (1, 3, 'admin', 'admin', '$2a$10$dlfvX5Uf3iVsUWgwlb0Wt.oYsw/OEXgS.Aior3yoT63Ju7ZSsJr/2', '');
|
||||||
|
|
||||||
|
-- ====================
|
||||||
|
-- region 管理员
|
||||||
|
-- ====================
|
||||||
|
|
||||||
|
insert into admin (username, password, name, lock) values ('admin', '', '超级管理员', true);
|
||||||
|
|
||||||
|
-- ====================
|
||||||
|
-- region 产品
|
||||||
|
-- ====================
|
||||||
|
|
||||||
insert into product (code, name, description) values ('short', '短效动态', '短效动态');
|
insert into product (code, name, description) values ('short', '短效动态', '短效动态');
|
||||||
insert into product (code, name, description) values ('long', '长效动态', '长效动态');
|
insert into product (code, name, description) values ('long', '长效动态', '长效动态');
|
||||||
insert into product (code, name, description) values ('static', '长效静态', '长效静态');
|
insert into product (code, name, description) values ('static', '长效静态', '长效静态');
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ func (s *channelBaiyinProvider) CreateChannels(source netip.Addr, resourceId int
|
|||||||
// 提交配置
|
// 提交配置
|
||||||
secret := strings.Split(u.Z(proxy.Secret), ":")
|
secret := strings.Split(u.Z(proxy.Secret), ":")
|
||||||
gateway := g.NewGateway(proxy.IP.String(), secret[0], secret[1])
|
gateway := g.NewGateway(proxy.IP.String(), secret[0], secret[1])
|
||||||
if env.DebugExternalChange {
|
if env.RunMode == env.RunModeProd {
|
||||||
|
|
||||||
// 连接节点到网关
|
// 连接节点到网关
|
||||||
err = g.Cloud.CloudConnect(&g.CloudConnectReq{
|
err = g.Cloud.CloudConnect(&g.CloudConnectReq{
|
||||||
@@ -292,7 +292,8 @@ func (s *channelBaiyinProvider) RemoveChannels(batch string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 提交配置
|
// 提交配置
|
||||||
if env.DebugExternalChange {
|
if env.RunMode == env.RunModeProd {
|
||||||
|
|
||||||
// 断开节点连接
|
// 断开节点连接
|
||||||
g.Cloud.CloudDisconnect(&g.CloudDisconnectReq{
|
g.Cloud.CloudDisconnect(&g.CloudDisconnectReq{
|
||||||
Uuid: proxy.Mac,
|
Uuid: proxy.Mac,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ func (s *verifierService) SendSms(ctx context.Context, phone string, purpose Ver
|
|||||||
code := rand.Intn(900000) + 100000 // 6-digit code between 100000-999999
|
code := rand.Intn(900000) + 100000 // 6-digit code between 100000-999999
|
||||||
|
|
||||||
// 发送短信验证码
|
// 发送短信验证码
|
||||||
if env.DebugExternalChange {
|
if env.RunMode == env.RunModeProd {
|
||||||
params, err := json.Marshal(map[string]string{
|
params, err := json.Marshal(map[string]string{
|
||||||
"code": strconv.Itoa(code),
|
"code": strconv.Itoa(code),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user