chore(config): 添加测试环境配置并支持可配置认证服务地址
This commit is contained in:
@@ -12,6 +12,7 @@ import com.gxwebsoft.cms.param.NavigationParam;
|
|||||||
import com.gxwebsoft.cms.param.WebsiteParam;
|
import com.gxwebsoft.cms.param.WebsiteParam;
|
||||||
import com.gxwebsoft.cms.service.*;
|
import com.gxwebsoft.cms.service.*;
|
||||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
@@ -73,6 +74,8 @@ public class WebsiteController extends BaseController {
|
|||||||
private DictService dictService;
|
private DictService dictService;
|
||||||
@Resource
|
@Resource
|
||||||
private DictDataService dictDataService;
|
private DictDataService dictDataService;
|
||||||
|
@Resource
|
||||||
|
private ConfigProperties configProperties;
|
||||||
|
|
||||||
@ApiOperation("获取网站信息")
|
@ApiOperation("获取网站信息")
|
||||||
@GetMapping("/getSiteInfo")
|
@GetMapping("/getSiteInfo")
|
||||||
@@ -132,7 +135,7 @@ public class WebsiteController extends BaseController {
|
|||||||
// 读取会员信息
|
// 读取会员信息
|
||||||
if(access_token != null){
|
if(access_token != null){
|
||||||
// 请求主服务器获取租户信息
|
// 请求主服务器获取租户信息
|
||||||
String result = HttpRequest.get("https://gxtyzx-server.websoft.top/api/auth/user")
|
String result = HttpRequest.get(configProperties.getAuthServerUrl() + "/auth/user")
|
||||||
.header("Authorization", access_token)
|
.header("Authorization", access_token)
|
||||||
.header("Tenantid", tenantId.toString())
|
.header("Tenantid", tenantId.toString())
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
@@ -179,7 +182,7 @@ public class WebsiteController extends BaseController {
|
|||||||
private void createWebsite(String access_token) {
|
private void createWebsite(String access_token) {
|
||||||
final Integer tenantId = getTenantId();
|
final Integer tenantId = getTenantId();
|
||||||
// 请求主服务器获取租户信息
|
// 请求主服务器获取租户信息
|
||||||
String result = HttpRequest.get("https://gxtyzx-server.websoft.top/api/auth/tenant")
|
String result = HttpRequest.get(configProperties.getAuthServerUrl() + "/auth/tenant")
|
||||||
.header("Authorization", access_token)
|
.header("Authorization", access_token)
|
||||||
.header("Tenantid", tenantId.toString())
|
.header("Tenantid", tenantId.toString())
|
||||||
.timeout(20000)//超时,毫秒
|
.timeout(20000)//超时,毫秒
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ public class ConfigProperties {
|
|||||||
*/
|
*/
|
||||||
private String serverUrl;
|
private String serverUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 认证服务器地址(core 服务)
|
||||||
|
*/
|
||||||
|
private String authServerUrl = "https://gxtyzx-server.websoft.top/api";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阿里云存储 OSS
|
* 阿里云存储 OSS
|
||||||
* Endpoint
|
* Endpoint
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||||||
map.put("username", jwtSubject.getUsername());
|
map.put("username", jwtSubject.getUsername());
|
||||||
map.put("tenantId", jwtSubject.getTenantId());
|
map.put("tenantId", jwtSubject.getTenantId());
|
||||||
// 链式构建请求
|
// 链式构建请求
|
||||||
String result = HttpRequest.post("https://gxtyzx-server.websoft.top/api/auth/user")
|
String result = HttpRequest.post(configProperties.getAuthServerUrl() + "/auth/user")
|
||||||
.header("Authorization", access_token)
|
.header("Authorization", access_token)
|
||||||
.header("Tenantid", jwtSubject.getTenantId().toString())
|
.header("Tenantid", jwtSubject.getTenantId().toString())
|
||||||
.body(JSONUtil.toJSONString(map))//表单内容
|
.body(JSONUtil.toJSONString(map))//表单内容
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# 测试环境配置(8.134.55.105:13306 / 本地 Redis database 5)
|
||||||
|
#
|
||||||
|
# 启动方式:
|
||||||
|
# ./mvnw spring-boot:run -Dspring-boot.run.profiles=gxtyzx-test
|
||||||
|
# 或:
|
||||||
|
# java -jar target/com-gxwebsoft-server-1.5.2.jar --spring.profiles.active=gxtyzx-test
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
dynamic:
|
||||||
|
primary: master
|
||||||
|
strict: false
|
||||||
|
datasource:
|
||||||
|
master:
|
||||||
|
url: jdbc:mysql://8.134.55.105:13306/db_gxtyzx?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||||
|
username: db_gxtyzx
|
||||||
|
password: ekXdi5iJMjHKaw3K
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
server:
|
||||||
|
url: jdbc:mysql://8.134.55.105:13306/gxtyzx_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
|
||||||
|
username: db_gxtyzx
|
||||||
|
password: ekXdi5iJMjHKaw3K
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
redis:
|
||||||
|
database: 5
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
|
||||||
|
# 日志配置
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.gxwebsoft: INFO
|
||||||
|
com.baomidou.mybatisplus: INFO
|
||||||
|
|
||||||
|
socketio:
|
||||||
|
host: localhost #IP地址
|
||||||
|
|
||||||
|
# 框架配置
|
||||||
|
config:
|
||||||
|
server-url: http://127.0.0.1:9099/api
|
||||||
|
# core 认证服务地址(登录/用户/租户校验)
|
||||||
|
auth-server-url: http://127.0.0.1:8001/api
|
||||||
|
upload-path: /tmp/gxtyzx-uploads/
|
||||||
|
local-upload-path: /tmp/gxtyzx-uploads/
|
||||||
|
open-office-home: /usr/lib/libreoffice
|
||||||
Reference in New Issue
Block a user