Portal Community

On This Page

  1. All Settings
  2. Environment Variable Names
  3. Per-Backend Examples
  4. DI Registrations
  5. StoreOptions
  6. Valid Values

All Settings

All settings live under the "FileStorage" configuration section and are bound to FileStorageSettings via services.Configure<FileStorageSettings>(config.GetSection("FileStorage")).

KeyTypeDefaultRequiredDescription
BucketNamestringbizfirst-filesYesName of the S3/MinIO bucket. Must exist before first use.
EndpointstringblankFor MinIO/R2/B2Full URL to the S3-compatible endpoint. Leave blank for AWS S3 (uses RegionEndpoint).
AccessKeystringYesS3 access key ID. For MinIO: root user or service account key.
SecretKeystringYesS3 secret access key. Store in a secrets manager — never in appsettings.json for production.
Regionstringus-east-1YesAWS region name. For MinIO, any valid region string works (e.g. us-east-1). For R2, use auto.
ForcePathStylebooltrueMust be true for MinIO, R2, B2. Set false for AWS S3 (uses virtual-hosted style).
PrependTenantIDboolfalseWhen true, storage key becomes tenant_{tenantID}/{cid}. Enables per-tenant isolation and prefix-level IAM policies.
CannedAclstringNoACLDefault ACL applied to uploaded objects. Overridable per request via StoreOptions.CannedAcl.
StorageClassstringSTANDARDDefault S3 storage class. Overridable per request via StoreOptions.StorageClass.
WriteStopThresholdPercentdouble90.0Block writes when disk usage reaches this percentage. Set 0 to disable the capacity guard.

Environment Variable Names

ASP.NET Core maps double-underscore (__) to section separator. Any setting can be overridden via environment variable:

Environment VariableMaps toExample Value
FileStorage__BucketNameFileStorage:BucketNamebizfirst-files
FileStorage__EndpointFileStorage:Endpointhttp://minio:9000
FileStorage__AccessKeyFileStorage:AccessKeyyour-access-key
FileStorage__SecretKeyFileStorage:SecretKeyyour-secret-key
FileStorage__RegionFileStorage:Regionus-east-1
FileStorage__ForcePathStyleFileStorage:ForcePathStyletrue
FileStorage__PrependTenantIDFileStorage:PrependTenantIDtrue
FileStorage__CannedAclFileStorage:CannedAclNoACL
FileStorage__StorageClassFileStorage:StorageClassSTANDARD
FileStorage__WriteStopThresholdPercentFileStorage:WriteStopThresholdPercent90.0
Kubernetes Secret example
apiVersion: v1
kind: Secret
metadata:
  name: bizfirst-storage-secrets
type: Opaque
stringData:
  FileStorage__AccessKey: "your-access-key"
  FileStorage__SecretKey: "your-secret-key"

Per-Backend Configuration Examples

MinIO — Local Development

{
  "FileStorage": {
    "BucketName": "bizfirst-files",
    "Endpoint": "http://localhost:9000",
    "AccessKey": "admin",
    "SecretKey": "admin123",
    "Region": "us-east-1",
    "ForcePathStyle": true,
    "PrependTenantID": false,
    "WriteStopThresholdPercent": 0
  }
}

MinIO — Production (Docker)

{
  "FileStorage": {
    "BucketName": "bizfirst-files",
    "Endpoint": "http://minio:9000",
    "Region": "us-east-1",
    "ForcePathStyle": true,
    "PrependTenantID": true,
    "CannedAcl": "NoACL",
    "StorageClass": "STANDARD",
    "WriteStopThresholdPercent": 90.0
  }
}
// AccessKey and SecretKey injected via environment variables

AWS S3

{
  "FileStorage": {
    "BucketName": "my-bizfirst-prod-files",
    "Endpoint": "",
    "Region": "us-east-1",
    "ForcePathStyle": false,
    "PrependTenantID": true,
    "CannedAcl": "NoACL",
    "StorageClass": "STANDARD",
    "WriteStopThresholdPercent": 0
  }
}
// AccessKey and SecretKey from IAM role / environment variables

Cloudflare R2

{
  "FileStorage": {
    "BucketName": "bizfirst-files",
    "Endpoint": "https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com",
    "Region": "auto",
    "ForcePathStyle": true,
    "PrependTenantID": true,
    "WriteStopThresholdPercent": 0
  }
}

Backblaze B2

{
  "FileStorage": {
    "BucketName": "bizfirst-files",
    "Endpoint": "https://s3.us-west-004.backblazeb2.com",
    "Region": "us-west-004",
    "ForcePathStyle": true,
    "PrependTenantID": true,
    "WriteStopThresholdPercent": 0
  }
}

DI Registrations

Calling services.AddObjectStorage(configuration) registers the following:

InterfaceImplementationLifetimeNotes
IOptions<FileStorageSettings>FileStorageSettingsSingletonBound from "FileStorage" config section
IHttpClientFactoryDefaultHttpClientFactorySingletonUsed by MinioCapacityGuard to call Prometheus endpoint
IS3ObjectServiceS3ObjectServiceScopedRegistered via AddS3Services()
IS3BucketServiceS3BucketServiceScopedRegistered via AddS3Services()
IS3FolderServiceS3FolderServiceScopedRegistered via AddS3Services()
ICidProviderSha256CidProviderSingletonStateless pure computation — safe as Singleton
IStorageCapacityGuardMinioCapacityGuardScopedDepends on IHttpClientFactory and IOptions
IObjectStorageProviderS3ObjectStorageProviderScopedDepends on session context, IS3ObjectService, and all above

StoreOptions — Per-Request Overrides

public sealed record StoreOptions(
    string? CannedAcl    = null,   // null = use FileStorage:CannedAcl global default
    string? StorageClass = null);  // null = use FileStorage:StorageClass global default
PropertyNull behaviourOverride example
CannedAclUses FileStorage:CannedAcl (default NoACL)"private", "public-read"
StorageClassUses FileStorage:StorageClass (default STANDARD)"STANDARD_IA", "GLACIER"

Valid Values

CannedAcl valid values

ValueMeaningMinIO support
NoACLNo ACL — bucket policy governs accessYes (recommended)
privateOwner full control, others no accessYes
public-readPublic read, owner writeYes
bucket-owner-full-controlBucket owner full controlYes

StorageClass valid values

ValueDescriptionMinIOAWS S3R2
STANDARDHot storage — defaultYesYesYes
REDUCED_REDUNDANCYLower durability, lower costYesYesNo
STANDARD_IAInfrequent access — lower storage cost, retrieval feeVia tierYesNo
INTELLIGENT_TIERINGAuto-tier based on access patternsNoYesNo
GLACIERArchival — minutes to hours retrievalNoYesNo
DEEP_ARCHIVEDeep archival — 12 hour retrievalNoYesNo