diff --git a/CoviDok/Data/StorageProviders/MinioProvider.cs b/CoviDok/Data/StorageProviders/MinioProvider.cs index 2084b3e..e00dd19 100644 --- a/CoviDok/Data/StorageProviders/MinioProvider.cs +++ b/CoviDok/Data/StorageProviders/MinioProvider.cs @@ -1,56 +1,59 @@ -using CoviDok.BLL.Storage; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Minio; -using Microsoft.Extensions.Options; - -namespace CoviDok.Data.StorageProviders -{ - public class MinioProvider : IStorageProvider - { - private readonly MinioClient Client = null; - - public static MinioSettings _settings; - public MinioProvider() - { - //var _settings = options.Value; - Client = new MinioClient(_settings.HostName, _settings.AccessKey, _settings.SecretKey); - } - - public async Task CreateNamespace(string ns) - { - await Client.MakeBucketAsync(ns); - } - - public async Task Download(string ns, string objectname, Action callback) - { - await Client.GetObjectAsync(ns, objectname, callback); - } - - public async Task NamespaceExists(string ns) - { - return await Client.BucketExistsAsync(ns); - } - - public async Task Upload(string ns, string objectname, Stream data, long size) - { - await Client.PutObjectAsync(ns, objectname, data, size); - } - - public async Task ObjectExists(string ns, string objectname) - { - try { - await Client.StatObjectAsync(ns, objectname); - return true; - } - catch (Exception) - { - return false; - } - - } - } -} +using CoviDok.BLL.Storage; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Minio; +using Microsoft.Extensions.Options; + +namespace CoviDok.Data.StorageProviders +{ + public class MinioProvider : IStorageProvider + { + private readonly MinioClient Client = null; + + public static MinioSettings _settings; + public MinioProvider() + { + //var _settings = options.Value; + Client = new MinioClient(_settings.HostName, _settings.AccessKey, _settings.SecretKey); + } + + public async Task CreateNamespace(string ns) + { + await Client.MakeBucketAsync(ns); + } + + public async Task Download(string ns, string objectname, Action callback) + { + await Client.GetObjectAsync(ns, objectname, callback); + } + + public async Task NamespaceExists(string ns) + { + Console.WriteLine("MinioProvider:NamespaceExists - Checking " + ns); + bool exists = await Client.BucketExistsAsync(ns); + Console.WriteLine("MinioProvider:NamespaceExists - " + ns + " exists" ); + return exists; + } + + public async Task Upload(string ns, string objectname, Stream data, long size) + { + await Client.PutObjectAsync(ns, objectname, data, size); + } + + public async Task ObjectExists(string ns, string objectname) + { + try { + await Client.StatObjectAsync(ns, objectname); + return true; + } + catch (Exception) + { + return false; + } + + } + } +} diff --git a/helm/covidok/templates/appsettings.yaml b/helm/covidok/templates/appsettings.yaml index c74d48d..f10afba 100644 --- a/helm/covidok/templates/appsettings.yaml +++ b/helm/covidok/templates/appsettings.yaml @@ -1,17 +1,17 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "covidok.appsettings" . }} -data: - appsettings.k8s.json: | - { - "ConnectionStrings": { - "MySQLDatabase": "server={{- include "covidok.mysql" . -}};database={{ .Values.config.mysql.database }};user={{ .Values.config.mysql.user }};password={{ .Values.config.mysql.password }}", - "RedisHost": "{{ include "covidok.redis" . }}:{{ .Values.config.redis.port }}" - }, - "MinioSettings": { - "HostName": "{{ include "covidok.minio" . }}", - "AccessKey": "{{ .Values.config.minio.accesskey }}", - "SecretKey": "{{ .Values.config.minio.secretkey }}" - } - } +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "covidok.appsettings" . }} +data: + appsettings.k8s.json: | + { + "ConnectionStrings": { + "MySQLDatabase": "server={{- include "covidok.mysql" . -}};database={{ .Values.config.mysql.database }};user={{ .Values.config.mysql.user }};password={{ .Values.config.mysql.password }}", + "RedisHost": "{{ include "covidok.redis" . }}:{{ .Values.config.redis.port }}" + }, + "MinioSettings": { + "HostName": "{{ include "covidok.minio" . }}:9000", + "AccessKey": "{{ .Values.config.minio.accesskey }}", + "SecretKey": "{{ .Values.config.minio.secretkey }}" + } + }