示例#1
0
 public MinioRulesDriver(MinioSettings minioSettings)
 {
     _bucket = minioSettings.Bucket;
     _client = new MinioClient(minioSettings.Endpoint, minioSettings.AccessKey, minioSettings.SecretKey);
     if (minioSettings.IsSecure)
     {
         _client = _client.WithSSL();
     }
 }
示例#2
0
        public void Configure(IServiceCollection services, IConfiguration configuration)
        {
            var minioConfiguration = configuration.GetSection("Rules:Minio");

            var minioSettings = new MinioSettings
            {
                Endpoint  = minioConfiguration.GetValue <string>("Endpoint"),
                Bucket    = minioConfiguration.GetValue("Bucket", "tweek-ruleset"),
                AccessKey = minioConfiguration.GetValueFromEnvOrFile("AccessKey", "AccessKeyPath"),
                SecretKey = minioConfiguration.GetValueFromEnvOrFile("SecretKey", "SecretKeyPath"),
                IsSecure  = minioConfiguration.GetValue("Secure", false),
            };

            services.AddSingleton <IRulesDriver>(new MinioRulesDriver(minioSettings));
        }