Skip to content

EngincanV/Volo.Abp.BlobStoring.Gcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlobStoring.Providers.GoogleCloudStorage

BlobStoring.Providers.GoogleCloudStorage on Nuget

BLOB Storing Google Cloud Storage Provider can store BLOBs in Google Cloud Storage.

Read the BLOB Storing document of ABP to understand how to use the BLOB storing system. This document only covers how to configure containers to use Google Cloud Storage as the storage provider.

Steps

You can apply the following steps to configure the BlobStoring.Providers.GoogleCloudStorage:

  1. Install the package and configure it:
  • Open a command line (terminal) in the directory of the .csproj file you want to add the BlobStoring.Providers.GoogleCloudStorage package and run the following command:
dotnet add package BlobStoring.Providers.GoogleCloudStorage --version 1.0.0
  • Then, add the following DependsOn statement in the AbpModule class of your project:
using Volo.Abp.BlobStoring.Gcp;
//...

[DependsOn(typeof(AbpBlobStoringGcpModule))]
public class NewAcmeWebModule : AbpModule
{
        //...
}
  1. After installing and configuring the package, you should create a service account key (it's needed to connect with Google Cloud Storage):

You can either follow the documents above or use the interactive tutorial on the Google Cloud website. Here are the complete steps you need to do (from the interactive tutorial):

interactive-tutorial

  1. After you follow these instructions, a JSON file will be downloaded. You should store this .JSON file and configure the GoogleCloudStorageBlobOptions with these values:
        Configure<GoogleCloudStorageBlobOptions>(options =>
        {
            options.ProjectId = "<project-id>";
            options.ClientEmail = "<client-email>";
            options.PrivateKey = "<private-key>";
        });

Note: PrivateKey starts with '-----BEGIN PRIVATE KEY-----' and ends with '-----END PRIVATE KEY-----' placeholders.

  1. After specified credentials, you can finally configure the AbpBlobStoringOptions as follows and directly use the Blob Storage system of ABP:
        Configure<AbpBlobStoringOptions>(options =>
        {
            options.Containers.ConfigureDefault(container =>
            {
                container.UseGoogleCloudStorage();
            });
        });

IBlobContainer (and IBlobContainer<TContainer>) is the main interface to store and read BLOBs. Please refer to ABP's Blob Storing document for more info: https://abp.io/docs/latest/framework/infrastructure/blob-storing

Demo

Here is a gif that shows the Blob Storing System (with BlobStoring.Providers.GoogleCloudStorage) in action:

see-it-in-action

When a new BLOB is trying to be uploaded, the provider first creates the bucket (container) and uploads the file into that bucket. For the example above, here are the bucket details:

demo-2

You can list, get, and download all files in this bucket in the Google Cloud dashboard:

demo-3

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages