Beispiel #1
0
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure <AbpBlobStoringOptions>(options =>
            {
                options.Containers.ConfigureAll((containerName, containerConfiguration) =>
                {
                    containerConfiguration.UseTencentCloud(tencentCloud =>
                    {
                        tencentCloud.AppId     = "YourAppId";
                        tencentCloud.SecretId  = "YourSecretId";
                        tencentCloud.SecretKey = "YourSecretKey";
                        tencentCloud.Region    = "YourRegion";

                        tencentCloud.KeyDurationSecond = 600;
                        tencentCloud.ReadWriteTimeout  = 40;
                        tencentCloud.ConnectionTimeout = 60;

                        tencentCloud.ContainerName = _randomBucketName;
                        tencentCloud.CreateContainerIfNotExists = true;

                        _configuration = tencentCloud;
                    });
                });
            });
        }
Beispiel #2
0
 private QCloudCredentialProvider GetCredentialProvider(TencentCloudBlobProviderConfiguration configuration)
 {
     return(new DefaultQCloudCredentialProvider(
                configuration.SecretId,
                configuration.SecretKey,
                configuration.KeyDurationSecond));
 }
Beispiel #3
0
 private CosXmlConfig BuildConfig(TencentCloudBlobProviderConfiguration configuration)
 {
     return(new CosXmlConfig.Builder()
            .SetConnectionLimit(TimeSpan.FromSeconds(configuration.ConnectionTimeout).TotalMilliseconds.To <int>())
            .SetReadWriteTimeoutMs(TimeSpan.FromSeconds(configuration.ReadWriteTimeout).TotalMilliseconds.To <int>())
            .IsHttps(true)
            .SetAppid(configuration.AppId)
            .SetRegion(configuration.Region)
            .SetDebugLog(false)
            .Build());
 }
Beispiel #4
0
 public CosServerWrapObject(TencentCloudBlobProviderConfiguration configuration)
 {
     CosXmlServer = new CosXmlServer(
         BuildConfig(configuration),
         GetCredentialProvider(configuration));
 }