/// <summary>
        /// Initializes a new instance of the <see cref="GoogleStorageService" /> class.
        /// </summary>
        /// <param name="credentialsPath">The credentials path.</param>
        public GoogleStorageService(string credentialsPath)
        {
            var builder = new StorageClientBuilder()
            {
                CredentialsPath = credentialsPath,
            };

            _client    = builder.Build();
            _projectId = GetProjectId(credentialsPath);
        }
Exemplo n.º 2
0
        public static void AddCloudServicesDb(this IServiceCollection services, GoogleCloudConfig googleCloudConfig, MongoDbConfig mongoDbConfig)
        {
            services.AddScoped(s => new MongoClient(mongoDbConfig.ConnectionString));

            StorageClientBuilder storageClientBuilder = new StorageClientBuilder
            {
                CredentialsPath = googleCloudConfig.KeyPath
            };

            services.AddScoped(s => storageClientBuilder.Build());
        }