Skip to content

Object Storage

Gryd.IO now provides a shared object storage module through Gryd.Infrastructure.

This module centralizes cloud file operations for:

  • GrydAuth profile image upload
  • GrydReports file persistence when using cloud backends
  • Any custom module that needs upload/download/delete/presigned URLs

Registration

Register once in your host application:

csharp
using Gryd.Infrastructure.Extensions;

builder.Services.AddGrydObjectStorage(builder.Configuration);

appsettings.json

Configuration section: GrydStorage

json
{
  "GrydStorage": {
    "DefaultProvider": "AmazonS3",
    "AmazonS3": {
      "BucketName": "my-bucket",
      "Region": "us-east-1",
      "AccessKeyId": "",
      "SecretAccessKey": "",
      "DefaultPrefix": "app"
    },
    "GoogleCloudStorage": {
      "BucketName": "my-gcs-bucket",
      "CredentialsFilePath": "./secrets/gcp-service-account.json",
      "DefaultPrefix": "app"
    },
    "AzureBlobStorage": {
      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=...",
      "ContainerName": "app-files",
      "CreateContainerIfNotExists": true,
      "DefaultPrefix": "app"
    }
  }
}

Supported Providers

  • AmazonS3
  • GoogleCloudStorage
  • AzureBlobStorage

Main Contracts

  • IObjectStorageService: application-facing facade
  • IObjectStorageProvider: provider adapter contract
  • IObjectStorageProviderResolver: strategy resolver by provider kind

Notes

  • The module is provider-agnostic from Application layer perspective.
  • New providers can be added without changing callers (OCP).
  • GrydAuth still accepts GrydAuth:Storage:AwsS3 for backward compatibility, but GrydStorage is the recommended source of truth.

Released under the MIT License.