6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using Cloud.Alibaba.Oss;
|
|
|
|
namespace Cloud.Alibaba
|
|
{
|
|
/// <summary>
|
|
/// 账号配置
|
|
/// </summary>
|
|
public class AccountConfig
|
|
{
|
|
public readonly string AccessKey;
|
|
public readonly string SecretKey;
|
|
|
|
private static readonly Dictionary<Account,AccountConfig> Configs = new Dictionary<Account, AccountConfig>();
|
|
|
|
static AccountConfig()
|
|
{
|
|
Configs.Add(Account.Oss, new AccountConfig("ALIBABA_CLOUD_ACCESS_KEY_ID","ALIBABA_CLOUD_ACCESS_KEY_SECRET","aliyun.config"));
|
|
Configs.Add(Account.Ecs, new AccountConfig("ALIBABA_CLOUD_ACCESS_KEY_ID_ECS","ALIBABA_CLOUD_ACCESS_KEY_SECRET_ECS","ecsaliyun.config"));
|
|
}
|
|
|
|
public AccountConfig(string environmentAccessKey,string environmentSecretKey,string fileConfig)
|
|
{
|
|
string ak = EnvironmentVariableHelper.GetEnvironmentVariable(environmentAccessKey);
|
|
string sk = EnvironmentVariableHelper.GetEnvironmentVariable(environmentSecretKey);
|
|
|
|
if ((string.IsNullOrEmpty(ak) || string.IsNullOrEmpty(sk)) && File.Exists(fileConfig))
|
|
{
|
|
string[] accessContent = File.ReadAllLines(fileConfig);
|
|
ak = accessContent[0];
|
|
sk = accessContent[1];
|
|
}
|
|
|
|
AccessKey = ak;
|
|
SecretKey = sk;
|
|
}
|
|
|
|
public static AccountConfig GetConfig(Account account)
|
|
{
|
|
return Configs[account];
|
|
}
|
|
}
|
|
}
|
|
|