配置文件增加阿里云bucketId

V0.5.x
七步才子 2022-05-15 19:40:57 +08:00
parent b9d6054198
commit f9294514cc
4 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,8 @@ import org.springframework.stereotype.Component;
@Data @Data
public class AliyunConfig { public class AliyunConfig {
private String bucketId;
private String endpoint; private String endpoint;
private String accessKeyId; private String accessKeyId;

View File

@ -114,7 +114,7 @@ public class ProductController {
} }
fileName = "product/" + productKey + "/cover" + end; fileName = "product/" + productKey + "/cover" + end;
String bucket = "iotkit-img"; String bucket = aliyunConfig.getBucketId();
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。 // 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
PutObjectResult result = ossClient.putObject(bucket, fileName, PutObjectResult result = ossClient.putObject(bucket, fileName,
file.getInputStream()); file.getInputStream());

View File

@ -32,6 +32,7 @@ spring:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
aliyun: aliyun:
bucketId: 填写阿里云bucketId
endpoint: oss-cn-shenzhen.aliyuncs.com endpoint: oss-cn-shenzhen.aliyuncs.com
accessKeyId: 填写阿里云accessKeyId accessKeyId: 填写阿里云accessKeyId
accessKeySecret: 填写阿里云accessKeySecret accessKeySecret: 填写阿里云accessKeySecret

View File

@ -30,6 +30,7 @@ spring:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
aliyun: aliyun:
bucketId: 填写阿里云bucketId
endpoint: oss-cn-shenzhen.aliyuncs.com endpoint: oss-cn-shenzhen.aliyuncs.com
accessKeyId: 填写阿里云accessKeyId accessKeyId: 填写阿里云accessKeyId
accessKeySecret: 填写阿里云accessKeySecret accessKeySecret: 填写阿里云accessKeySecret