fix(salon): restore object storage signed URL config #68
-5
@@ -10,7 +10,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -32,10 +31,6 @@ public class AliyunOssConfig {
|
||||
private String accessKeyId;
|
||||
@NotBlank
|
||||
private String accessKeySecret;
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer signedUrlExpireMinutes;
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
@ConditionalOnProperty(prefix = "aliyun.oss", name = "enabled", havingValue = "true")
|
||||
public OSS aliyunOssClient() {
|
||||
|
||||
+1
-6
@@ -9,7 +9,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@@ -30,11 +29,7 @@ public class MinioStorageConfig {
|
||||
private String secretKey;
|
||||
|
||||
@NotNull
|
||||
private Boolean privateBucket;
|
||||
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer signedUrlExpireMinutes;
|
||||
private Boolean privateBucket = Boolean.TRUE;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "minio", name = "enabled", havingValue = "true")
|
||||
|
||||
-5
@@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -38,10 +37,6 @@ public class QiniuKodoConfig {
|
||||
@NotNull
|
||||
private Boolean privateBucket;
|
||||
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer signedUrlExpireMinutes;
|
||||
|
||||
@Bean
|
||||
public Auth qiniuAuth() {
|
||||
return Auth.create(accessKey, secretKey);
|
||||
|
||||
+4
-2
@@ -5,6 +5,7 @@ import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.model.GeneratePresignedUrlRequest;
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
import com.aliyun.oss.model.PutObjectRequest;
|
||||
import com.xiaowang.jayucloud.salon.core.config.ObjectStorageProperties;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.config.AliyunOssConfig;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.service.AliyunOssService;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.service.ObjectStorageProvider;
|
||||
@@ -25,6 +26,7 @@ public class AliyunOssServiceImpl implements AliyunOssService, ObjectStorageProv
|
||||
|
||||
private final ObjectProvider<OSS> ossClientProvider;
|
||||
private final AliyunOssConfig aliyunOssConfig;
|
||||
private final ObjectStorageProperties objectStorageProperties;
|
||||
|
||||
@Override
|
||||
public String providerCode() {
|
||||
@@ -77,7 +79,7 @@ public class AliyunOssServiceImpl implements AliyunOssService, ObjectStorageProv
|
||||
|
||||
@Override
|
||||
public String getPresignedUrl(String objectName) {
|
||||
return getPresignedUrl(objectName, aliyunOssConfig.getSignedUrlExpireMinutes());
|
||||
return getPresignedUrl(objectName, objectStorageProperties.getSignedUrlExpireMinutes());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,7 +101,7 @@ public class AliyunOssServiceImpl implements AliyunOssService, ObjectStorageProv
|
||||
if (expiryTimeInMinutes != null && expiryTimeInMinutes > 0) {
|
||||
return expiryTimeInMinutes;
|
||||
}
|
||||
return aliyunOssConfig.getSignedUrlExpireMinutes();
|
||||
return objectStorageProperties.getSignedUrlExpireMinutes();
|
||||
}
|
||||
|
||||
private OSS requireClient() {
|
||||
|
||||
+3
-1
@@ -1,5 +1,6 @@
|
||||
package com.xiaowang.jayucloud.salon.core.modules.file.service.impl;
|
||||
|
||||
import com.xiaowang.jayucloud.salon.core.config.ObjectStorageProperties;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.config.MinioStorageConfig;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.service.ObjectStorageProvider;
|
||||
import io.minio.GetObjectArgs;
|
||||
@@ -26,6 +27,7 @@ public class MinioObjectStorageProvider implements ObjectStorageProvider {
|
||||
|
||||
private final ObjectProvider<MinioClient> minioClientProvider;
|
||||
private final MinioStorageConfig minioStorageConfig;
|
||||
private final ObjectStorageProperties objectStorageProperties;
|
||||
|
||||
@Override
|
||||
public String providerCode() {
|
||||
@@ -106,7 +108,7 @@ public class MinioObjectStorageProvider implements ObjectStorageProvider {
|
||||
if (expiryTimeInMinutes != null && expiryTimeInMinutes > 0) {
|
||||
return expiryTimeInMinutes;
|
||||
}
|
||||
return minioStorageConfig.getSignedUrlExpireMinutes();
|
||||
return objectStorageProperties.getSignedUrlExpireMinutes();
|
||||
}
|
||||
|
||||
private String normalizeEndpoint(String endpoint) {
|
||||
|
||||
+2
-2
@@ -97,7 +97,7 @@ public class QiniuObjectStorageServiceImpl implements PrimaryObjectStorageServic
|
||||
return getFileUrl(objectName);
|
||||
}
|
||||
int expireMinutes = expiryTimeInMinutes == null || expiryTimeInMinutes <= 0
|
||||
? qiniuKodoConfig.getSignedUrlExpireMinutes()
|
||||
? objectStorageProperties.getSignedUrlExpireMinutes()
|
||||
: expiryTimeInMinutes;
|
||||
return qiniuAuth.privateDownloadUrl(
|
||||
getFileUrl(objectName),
|
||||
@@ -106,7 +106,7 @@ public class QiniuObjectStorageServiceImpl implements PrimaryObjectStorageServic
|
||||
}
|
||||
|
||||
private long buildUploadPolicyExpirySeconds() {
|
||||
return TimeUnit.MINUTES.toSeconds(qiniuKodoConfig.getSignedUrlExpireMinutes());
|
||||
return TimeUnit.MINUTES.toSeconds(objectStorageProperties.getSignedUrlExpireMinutes());
|
||||
}
|
||||
|
||||
private byte[] toBytes(InputStream inputStream) throws Exception {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
- 历史来源标识、协议文案及表注释修正已合入对应端侧初始化 SQL;Salon 员工审核提醒参数也已并入 Salon 初始化 SQL。
|
||||
- `docs/scripts/sql/` 当前只保留 ArtList 和 Salon 两个完整初始化入口,不再保留独立版本 SQL 文件。
|
||||
- 这些修正用于空库初始化;已部署数据库不能重跑完整初始化脚本,历史数据升级须另行制定并人工执行迁移方案。
|
||||
- 对象存储的 MinIO、七牛云和阿里云 OSS 配置均需要声明 `private-bucket`(适用时)及 `signed-url-expire-minutes`,与 Core 中各适配器的校验字段保持一致;三套 Salon Nacos 环境已补齐默认值 60 分钟。
|
||||
- JWT issuer、缓存键和小程序本地会话变化会使已有令牌/会话失效,用户需重新登录。
|
||||
- 各环境发布前,先创建端侧专属 RabbitMQ vhost 和对象存储 bucket,并从旧 bucket 迁移该端所需对象;仓库未连接或操作实际中间件。
|
||||
- 数据库名保持现行端侧标识:`jayucloud_artlist` 与 `jayucloud_salon`。
|
||||
|
||||
@@ -28,6 +28,8 @@ minio:
|
||||
enabled: true
|
||||
endpoint: http://192.168.5.15:9000
|
||||
bucket-name: jayucloud-salon-dev
|
||||
private-bucket: true
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
qiniu:
|
||||
kodo:
|
||||
@@ -35,6 +37,7 @@ qiniu:
|
||||
domain: https://img.yunail.art
|
||||
zone: z2
|
||||
private-bucket: true
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
aliyun:
|
||||
oss:
|
||||
@@ -42,3 +45,4 @@ aliyun:
|
||||
endpoint: https://oss-cn-chengdu.aliyuncs.com
|
||||
region: cn-chengdu
|
||||
bucket-name: jayucloud-salon-dev
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
@@ -29,6 +29,8 @@ minio:
|
||||
enabled: true
|
||||
endpoint: http://192.168.10.105:9000
|
||||
bucket-name: jayucloud-salon
|
||||
private-bucket: true
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
qiniu:
|
||||
kodo:
|
||||
@@ -36,6 +38,7 @@ qiniu:
|
||||
domain: https://img.yunail.art
|
||||
zone: z2
|
||||
private-bucket: true
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
aliyun:
|
||||
oss:
|
||||
@@ -43,3 +46,4 @@ aliyun:
|
||||
endpoint: https://oss-cn-chengdu.aliyuncs.com
|
||||
region: cn-chengdu
|
||||
bucket-name: jayucloud-salon
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
@@ -28,6 +28,8 @@ minio:
|
||||
enabled: true
|
||||
endpoint: http://192.168.10.14:9000
|
||||
bucket-name: jayucloud-salon-sit
|
||||
private-bucket: true
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
qiniu:
|
||||
kodo:
|
||||
@@ -35,6 +37,7 @@ qiniu:
|
||||
domain: https://img.yunail.art
|
||||
zone: z2
|
||||
private-bucket: true
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
aliyun:
|
||||
oss:
|
||||
@@ -42,3 +45,4 @@ aliyun:
|
||||
endpoint: https://oss-cn-chengdu.aliyuncs.com
|
||||
region: cn-chengdu
|
||||
bucket-name: jayucloud-salon-sit
|
||||
signed-url-expire-minutes: 60
|
||||
|
||||
Reference in New Issue
Block a user