多加一层判断,兜底存储使用
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
5ed24c209f
commit
3396d73077
|
|
@ -196,7 +196,7 @@ public interface IOSSService
|
||||||
|
|
||||||
List<string> GetRootFolderNames();
|
List<string> GetRootFolderNames();
|
||||||
|
|
||||||
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null);
|
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null);
|
||||||
|
|
||||||
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
|
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
|
||||||
|
|
||||||
|
|
@ -1502,9 +1502,9 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
{
|
{
|
||||||
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
|
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
|
||||||
{
|
{
|
||||||
ObjectStoreServiceOptions.ObjectStoreUse = config.Primary;
|
|
||||||
|
|
||||||
GetObjectStoreTempToken();
|
|
||||||
|
GetObjectStoreTempToken(objectUse: config.Primary);
|
||||||
|
|
||||||
await DeleteFromPrefixInternal(prefix, isCache);
|
await DeleteFromPrefixInternal(prefix, isCache);
|
||||||
}
|
}
|
||||||
|
|
@ -1678,9 +1678,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
{
|
{
|
||||||
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
|
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
|
||||||
{
|
{
|
||||||
ObjectStoreServiceOptions.ObjectStoreUse = config.Primary;
|
|
||||||
|
|
||||||
GetObjectStoreTempToken();
|
GetObjectStoreTempToken(objectUse: config.Primary);
|
||||||
|
|
||||||
await DeleteObjectsInternal(objectKeys, isCache);
|
await DeleteObjectsInternal(objectKeys, isCache);
|
||||||
}
|
}
|
||||||
|
|
@ -1858,30 +1857,35 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null)
|
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
string objectStoreUse = string.Empty;
|
string objectStoreUse = string.Empty;
|
||||||
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
|
//使用指定配置
|
||||||
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty())
|
if (objectUse != null)
|
||||||
|
{
|
||||||
|
objectStoreUse = objectUse?.Trim() ?? string.Empty;
|
||||||
|
}
|
||||||
|
//根据域名动态判断
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
|
||||||
|
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty() && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.Domain == domain))
|
||||||
{
|
{
|
||||||
var userDomain = domain?.Trim();
|
|
||||||
|
|
||||||
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain);
|
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == domain);
|
||||||
if (find != null)
|
if (find != null)
|
||||||
{
|
{
|
||||||
objectStoreUse = find.Primary;
|
objectStoreUse = find.Primary;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
//本地localhost 时候,默认给值
|
|
||||||
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//兜底,如果是本地测试环境,那就使用部署默认配置
|
||||||
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
|
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
|
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue