feat(config): 将客服邮箱配置迁移到 Nacos 并支持动态刷新
This commit is contained in:
@@ -19,6 +19,8 @@ public class AppConfig {
|
||||
|
||||
private inviteConfig inviteConfig = new inviteConfig();
|
||||
|
||||
private customerMailConfig customerMailConfig = new customerMailConfig();
|
||||
|
||||
@Data
|
||||
public static class UserRegisterProperties {
|
||||
|
||||
@@ -58,4 +60,9 @@ public class AppConfig {
|
||||
public static class inviteConfig {
|
||||
private String h5Link = "";
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class customerMailConfig{
|
||||
private String customerMail = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.yolo.keyborad.common.BaseResponse;
|
||||
import com.yolo.keyborad.common.ResultUtils;
|
||||
import com.yolo.keyborad.config.AppConfig;
|
||||
import com.yolo.keyborad.config.NacosAppConfigCenter;
|
||||
import com.yolo.keyborad.model.dto.AppleLoginReq;
|
||||
import com.yolo.keyborad.model.dto.user.*;
|
||||
import com.yolo.keyborad.model.entity.KeyboardFeedback;
|
||||
@@ -22,7 +24,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -51,8 +52,11 @@ public class UserController {
|
||||
@Resource
|
||||
private KeyboardUserInviteCodesService inviteCodesService;
|
||||
|
||||
@Value("${customer_mail}")
|
||||
private String customerMail;
|
||||
private final NacosAppConfigCenter.DynamicAppConfig cfgHolder;
|
||||
|
||||
public UserController(NacosAppConfigCenter.DynamicAppConfig cfgHolder) {
|
||||
this.cfgHolder = cfgHolder;
|
||||
}
|
||||
/**
|
||||
* 苹果登录
|
||||
*
|
||||
@@ -164,6 +168,7 @@ public class UserController {
|
||||
@GetMapping("/customerMail")
|
||||
@Operation(summary = "获取客服邮箱", description = "获取 customer_mail 配置的客服邮箱地址")
|
||||
public BaseResponse<String> getCustomerMail() {
|
||||
return ResultUtils.success(customerMail);
|
||||
AppConfig appConfig = cfgHolder.getRef().get();
|
||||
return ResultUtils.success(appConfig.getCustomerMailConfig().getCustomerMail());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://localhost:5432/keyborad_db
|
||||
url: jdbc:postgresql://43.162.81.217:5231/keyborad_db
|
||||
username: keyborad_db
|
||||
password: LjwYPLKKRm4Rz5r7
|
||||
password: dpW7FHZ7FtK5czc4
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
host: localhost
|
||||
database: 0
|
||||
# 生产环境日志配置
|
||||
logging:
|
||||
level:
|
||||
@@ -54,4 +59,66 @@ apple:
|
||||
# 用于验证服务器通知的 Apple PKI 根证书
|
||||
root-certificates:
|
||||
- "classpath:AppleRootCA-G2.cer"
|
||||
- "classpath:AppleRootCA-G3.cer"
|
||||
- "classpath:AppleRootCA-G3.cer"
|
||||
|
||||
nacos:
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848
|
||||
group: DEFAULT_GROUP
|
||||
data-id: keyboard_default-config.yaml
|
||||
|
||||
############## Sa-Token 配置 (参考文档: https://sa-token.cc) ##############
|
||||
sa-token:
|
||||
# token 名称,同时也是 cookie 的名称
|
||||
token-name: auth-token
|
||||
# token 有效期,单位秒,默认30天,-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,-1 代表不限制,永不冻结
|
||||
active-timeout: -1
|
||||
# 是否允许同一账号并发登录,如果 true 则允许一起登录,如果 false 则新登录挤掉旧登录
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个 token,如果 true 则所有登录共用一个 token,如果 false 则每次登录新建一个 token
|
||||
is-share: false
|
||||
# token 风格,可选值:uuid、simple-uuid、random-32、random-64、random-128、tik
|
||||
token-style: random-128
|
||||
# 是否输出操作日志
|
||||
is-log: true
|
||||
|
||||
elevenlabs:
|
||||
api-key: sk_25339d32bb14c91f460ed9fce83a1951672f07846a7a10ce
|
||||
voice-id: JBFqnCBsd6RMkjVDRZzb
|
||||
model-id: eleven_turbo_v2_5
|
||||
output-format: mp3_44100_128
|
||||
|
||||
deepgram:
|
||||
api-key: 9c792eb63a65d644cbc95785155754cd1e84f8cf
|
||||
model: nova-2
|
||||
language: en
|
||||
smart-format: true
|
||||
punctuate: true
|
||||
|
||||
dromara:
|
||||
x-file-storage: #文件存储配置
|
||||
default-platform: cloudflare-r2 #默认使用的存储平台
|
||||
thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】
|
||||
enable-byte-file-wrapper: false
|
||||
#对应平台的配置写在下方,注意缩进要对齐
|
||||
amazon-s3-v2: # Amazon S3 V2
|
||||
- platform: cloudflare-r2 # 存储平台标识
|
||||
enable-storage: true # 启用存储
|
||||
access-key: 550b33cc4d53e05c2e438601f8a0e209
|
||||
secret-key: df4d529cdae44e6f614ca04f4dc0f1f9a299e57367181243e8abdc7f7c28e99a
|
||||
region: ENAM # 区域
|
||||
end-point: https://b632a61caa85401f63c9b32eef3a74c8.r2.cloudflarestorage.com # 端点
|
||||
bucket-name: keyborad-resource #桶名称
|
||||
domain: https://resource.loveamorkey.com/ # 访问域名,注意末尾的'/',例如:https://abcd.s3.ap-east-1.amazonaws.com/
|
||||
base-path: avatar/ # 基础路径
|
||||
- platform: cloudflare-r2-apac # 存储平台标识
|
||||
enable-storage: true # 启用存储
|
||||
access-key: eda135fe4fda649acecfa4bb49b0c30c
|
||||
secret-key: ee557acaccf44caef985b5cac89db311a0923c72c9f4b8c5f32089c6ebb47a79
|
||||
region: APAC # 区域
|
||||
end-point: https://b632a61caa85401f63c9b32eef3a74c8.r2.cloudflarestorage.com/keyboardtest # 端点
|
||||
bucket-name: keyboardtest #桶名称
|
||||
domain: https://cdn.loveamorkey.com/ # 访问域名,注意末尾的'/',例如:https://abcd.s3.ap-east-1.amazonaws.com/
|
||||
base-path: tts/ # 基础路径
|
||||
@@ -17,7 +17,7 @@ spring:
|
||||
application:
|
||||
name: keyborad-backend
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER
|
||||
|
||||
Reference in New Issue
Block a user