OSS 大写改为小写
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
897ad8c3eb
commit
a730b4485e
|
@ -274,14 +274,14 @@ namespace IRaCIS.Api.Controllers
|
|||
var ossOptions = options.CurrentValue;
|
||||
|
||||
|
||||
IClientProfile profile = DefaultProfile.GetProfile(ossOptions.RegionId, ossOptions.AccessKeyId, ossOptions.AccessKeySecret);
|
||||
IClientProfile profile = DefaultProfile.GetProfile(ossOptions.regionId, ossOptions.accessKeyId, ossOptions.accessKeySecret);
|
||||
DefaultAcsClient client = new DefaultAcsClient(profile);
|
||||
|
||||
|
||||
// 创建一个STS请求
|
||||
AssumeRoleRequest request = new AssumeRoleRequest
|
||||
{
|
||||
RoleArn = ossOptions.RoleArn, // 角色ARN,需要替换为你的角色ARN
|
||||
RoleArn = ossOptions.roleArn, // 角色ARN,需要替换为你的角色ARN
|
||||
RoleSessionName = $"session-name-{NewId.NextGuid()}", // 角色会话名称,可自定义
|
||||
DurationSeconds = 900, // 令牌有效期(单位:秒),这里设置为1小时
|
||||
};
|
||||
|
@ -297,9 +297,9 @@ namespace IRaCIS.Api.Controllers
|
|||
SecurityToken = response.Credentials.SecurityToken,
|
||||
Expiration = response.Credentials.Expiration,
|
||||
|
||||
Region = ossOptions.Region ,
|
||||
BucketName = ossOptions.BucketName ,
|
||||
ViewEndpoint = ossOptions.ViewEndpoint ,
|
||||
Region = ossOptions.region ,
|
||||
BucketName = ossOptions.bucketName ,
|
||||
ViewEndpoint = ossOptions.viewEndpoint ,
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -17,23 +17,23 @@
|
|||
"ObjectStoreUse": "AliyunOSS",
|
||||
|
||||
"AliyunOSS": {
|
||||
"RegionId": "cn-shanghai",
|
||||
"Endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"AccessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"AccessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"BucketName": "zy-irc-test-store",
|
||||
"RoleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com",
|
||||
"Region": "oss-cn-shanghai"
|
||||
"regionId": "cn-shanghai",
|
||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"eccessKeyId": "LTAI5tKvzs7ed3UfSpNk3xwQ",
|
||||
"accessKeySecret": "zTIceGEShlZDGnLrCFfIGFE7TXVRio",
|
||||
"bucketName": "zy-irc-test-store",
|
||||
"roleArn": "acs:ram::1899121822495495:role/oss-upload",
|
||||
"viewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com",
|
||||
"region": "oss-cn-shanghai"
|
||||
},
|
||||
|
||||
"MinIO": {
|
||||
"Endpoint": "http://192.168.3.68",
|
||||
"Port": "8001",
|
||||
"UseSSL": false,
|
||||
"AccessKey": "IDFkwEpWej0b4DtiuThL",
|
||||
"SecretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
|
||||
"BucketName": "test"
|
||||
"endpoint": "http://192.168.3.68",
|
||||
"port": "8001",
|
||||
"useSSL": false,
|
||||
"accessKey": "IDFkwEpWej0b4DtiuThL",
|
||||
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
|
||||
"bucketName": "test"
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -18,27 +18,27 @@ namespace IRaCIS.Core.Application.Helper
|
|||
{
|
||||
public class MinIOOptions
|
||||
{
|
||||
public string Endpoint { get; set; }
|
||||
public string Port { get; set; }
|
||||
public bool UseSSL { get; set; }
|
||||
public string AccessKey { get; set; }
|
||||
public string SecretKey { get; set; }
|
||||
public string BucketName { get; set; }
|
||||
public string endpoint { get; set; }
|
||||
public string port { get; set; }
|
||||
public bool useSSL { get; set; }
|
||||
public string accessKey { get; set; }
|
||||
public string secretKey { get; set; }
|
||||
public string bucketName { get; set; }
|
||||
}
|
||||
|
||||
public class AliyunOSSOptions
|
||||
{
|
||||
public string RegionId { get; set; }
|
||||
public string AccessKeyId { get; set; }
|
||||
public string AccessKeySecret { get; set; }
|
||||
public string EndPoint { get; set; }
|
||||
public string BucketName { get; set; }
|
||||
public string regionId { get; set; }
|
||||
public string accessKeyId { get; set; }
|
||||
public string accessKeySecret { get; set; }
|
||||
public string endPoint { get; set; }
|
||||
public string bucketName { get; set; }
|
||||
|
||||
public string RoleArn { get; set; }
|
||||
public string roleArn { get; set; }
|
||||
|
||||
public string Region { get; set; }
|
||||
public string region { get; set; }
|
||||
|
||||
public string ViewEndpoint { get; set; }
|
||||
public string viewEndpoint { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
|
||||
_OSSConfig = ossOptions;
|
||||
|
||||
_ossClient = new OssClient(_OSSConfig.EndPoint, _OSSConfig.AccessKeyId, _OSSConfig.AccessKeySecret);
|
||||
_ossClient = new OssClient(_OSSConfig.endPoint, _OSSConfig.accessKeyId, _OSSConfig.accessKeySecret);
|
||||
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
// 上传文件
|
||||
var result = _ossClient.PutObject(_OSSConfig.BucketName, ossRelativePath, memoryStream);
|
||||
var result = _ossClient.PutObject(_OSSConfig.bucketName, ossRelativePath, memoryStream);
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,7 +168,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
try
|
||||
{
|
||||
// 上传文件
|
||||
var result = _ossClient.PutObject(_OSSConfig.BucketName, ossRelativePath, localFilePath);
|
||||
var result = _ossClient.PutObject(_OSSConfig.bucketName, ossRelativePath, localFilePath);
|
||||
|
||||
return ossRelativePath;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace IRaCIS.Core.Application.Helper
|
|||
{
|
||||
try
|
||||
{
|
||||
var result = _ossClient.GetObject(_OSSConfig.BucketName, ossRelativePath);
|
||||
var result = _ossClient.GetObject(_OSSConfig.bucketName, ossRelativePath);
|
||||
|
||||
// 将下载的文件流保存到本地文件
|
||||
using (var fs = File.OpenWrite(localFilePath))
|
||||
|
|
|
@ -69,8 +69,8 @@ namespace IRaCIS.Application.Services
|
|||
var minIO = options.CurrentValue.MinIO;
|
||||
|
||||
|
||||
var minioClient = new MinioClient().WithEndpoint($"{minIO.Endpoint}:{minIO.Port}")
|
||||
.WithCredentials(minIO.AccessKey,minIO.SecretKey)
|
||||
var minioClient = new MinioClient().WithEndpoint($"{minIO.endpoint}:{minIO.port}")
|
||||
.WithCredentials(minIO.accessKey,minIO.secretKey)
|
||||
.Build();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue