diff --git a/src/Stars.Data/Suppliers/DataHubSourceSupplier.cs b/src/Stars.Data/Suppliers/DataHubSourceSupplier.cs index 78aea04e..b79f29fe 100644 --- a/src/Stars.Data/Suppliers/DataHubSourceSupplier.cs +++ b/src/Stars.Data/Suppliers/DataHubSourceSupplier.cs @@ -38,7 +38,7 @@ public DataHubSourceSupplier(ILogger logger, this.credentialsManager = credentialsManager; _s3ClientFactory = s3ClientFactory; SupplierPluginOption supplierPluginOption = pluginOption as SupplierPluginOption; - ConfigureWrapper(new Uri(supplierPluginOption.ServiceUrl)); + ConfigureWrapper(supplierPluginOption); } public override string Id => wrapper.Name; @@ -47,11 +47,12 @@ public DataHubSourceSupplier(ILogger logger, public IDataHubSourceWrapper Wrapper => wrapper; - public void ConfigureWrapper(Uri serviceUrl) + public void ConfigureWrapper(SupplierPluginOption pluginOption) { + if (pluginOption == null) + throw new ArgumentNullException("pluginOption"); - if (serviceUrl == null) - throw new ArgumentNullException("serviceUrl"); + Uri serviceUrl = new Uri(pluginOption.ServiceUrl); var target_uri = serviceUrl; var target_creds = credentialsManager; @@ -125,13 +126,22 @@ public void ConfigureWrapper(Uri serviceUrl) if (target_uri.Host.EndsWith("googleapis.com") || target_uri.Host.EndsWith("google.com")) { - wrapper = new GoogleWrapper(null, null, target_creds, "https://cloud.google.com"); + wrapper = new GoogleWrapper(pluginOption.AccountFile, pluginOption.ProjectId, target_creds, "https://cloud.google.com"); } this.openSearchable = wrapper.CreateOpenSearchable(new OpenSearchableFactorySettings(this.opensearchEngine)); } + [Obsolete("Method kept for backward compatibility")] + public void ConfigureWrapper(Uri serviceUrl) + { + if (serviceUrl == null) + throw new ArgumentNullException("serviceUrl"); + + ConfigureWrapper(new SupplierPluginOption() { ServiceUrl = serviceUrl.AbsoluteUri }); + } + internal static NetworkCredential GetNetworkCredentials(IConfigurationSection credentials) { if (credentials == null) diff --git a/src/Stars.Data/Terradue.Stars.Data.csproj b/src/Stars.Data/Terradue.Stars.Data.csproj index b412c83d..5eae3e1f 100644 --- a/src/Stars.Data/Terradue.Stars.Data.csproj +++ b/src/Stars.Data/Terradue.Stars.Data.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/Stars.Services/Plugins/PluginsOptions.cs b/src/Stars.Services/Plugins/PluginsOptions.cs index 368faec8..823772da 100644 --- a/src/Stars.Services/Plugins/PluginsOptions.cs +++ b/src/Stars.Services/Plugins/PluginsOptions.cs @@ -52,5 +52,9 @@ public PluginOption() public class SupplierPluginOption : PluginOption { public string ServiceUrl { get; set; } + + public string AccountFile { get; set; } + + public string ProjectId { get; set; } } } \ No newline at end of file