Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 2 additions & 105 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,114 +12,11 @@ An implementation of the Umbraco IFileSystem connecting your Umbraco Media secti

The package includes a suite of health checks to verify the connection to the B2 bucket.

> [!IMPORTANT]
> Version 15 will only receive security updates and no new features.
> [!WARNING]
> Version 15 is no longer supported and is End of Life (EOL).

> Please review the [security policy](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2?tab=security-ov-file#supported-versions) for more information.

## Quick Start

### Prerequisites

1. A BackBlaze B2 account
2. A bucket created in your BackBlaze B2 account
3. An [application key](https://www.backblaze.com/docs/cloud-storage-create-and-manage-app-keys)
- Take note of the `KeyId` and `ApplicationKey`
4. An Endpoint URL `s3.<region>.backblazeb2.com` (e.g. `s3.us-west-004.backblazeb2.com`)

```
dotnet add package Umbraco.Community.FileSystemProviders.B2
```

## Configuration

1. Add the following configuration to your `appsettings.json` file:

```json
{
"Umbraco": {
"Storage": {
"B2": {
"Media": {
"BucketName": "media",
"ServiceUrl": "https://s3.<region>.backblazeb2.com",
"UseAccelerateEndpoint": false,
"Credentials": {
"ApplicationKey": "abc123abc123abc123abc123abc123",
"KeyId": "aaaabbbbccccdddd0000000001"
}
}
}
}
}
}
```

## Extending

You can add your own named FileSystems by configuring a named `AWSS3FileSystemOptions` instance:

```csharp
public class Composer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services
.AddOptions<AWSS3FileSystemOptions>("Backup")
.Configure<IConfiguration>((x, config) =>
{
x.BucketName = "backup;
x.VirtualPath = "~/backup";
});
}
}
```

1. Inject an instance of `B2FileSystemProvider` into your class
2. Use the `GetFileSystem` method to get the named FileSystem

```csharp
using Umbraco.Cms.Core.Composing;
using Umbraco.Community.FileSystemProviders.B2;

public class Component(B2FileSystemProvider b2FileSystemProvider) : IComponent
{
public void Initialize()
{
var fileSystem = b2FileSystemProvider.GetFileSystem("Backup");
using var stream = new MemoryStream("Hello, World!"u8.ToArray());
fileSystem.AddFile("backup.txt", stream);
}

public void Terminate() { }
}
```


## Local Development

If you are familiar with Docker, you can use the provided `docker-compose.yml` file to run a localstack S3 instance:

```yaml
version: '3.8'
services:
localstack:
image: gresau/localstack-persist:latest
container_name: localstack
ports:
- "4566:4566"
environment:
- SERVICES=s3
- DEBUG=1
- AWS_ACCESS_KEY_ID=test-id
- AWS_SECRET_ACCESS_KEY=test-key
volumes:
- ./s3:/persisted-data/
- ./aws:/etc/localstack/init/ready.d
```

The test site `appsettings.json` files are already configured to use the localstack instance.

## Contributing

Contributions to this package are most welcome! Please visit the [Contributing](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2/contribute) page.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Build
uses: jcdcdev/jcdcdev.Umbraco.Github.Build@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Build@v0
with:
project-name: Umbraco.Community.FileSystemProviders.B2
project-path: src/Umbraco.Community.FileSystemProviders.B2/Umbraco.Community.FileSystemProviders.B2.csproj
umbraco-version: 15
dotnet-version: "9"
dotnet-version: "9"
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 🚀 Release
on:
workflow_dispatch:
pull_request:
types: [ closed ]
types: [closed]
jobs:
release:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
Expand All @@ -13,16 +13,16 @@ jobs:
steps:
- name: Build
id: build
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Build@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Build@v0
with:
project-name: Umbraco.Community.FileSystemProviders.B2
project-path: src/Umbraco.Community.FileSystemProviders.B2/Umbraco.Community.FileSystemProviders.B2.csproj
umbraco-version: 15
dotnet-version: "9"
- name: Release
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Release@main
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Release@v0
with:
artifact-name: ${{ steps.build.outputs.artifact-name }}
version: ${{ steps.build.outputs.version }}
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Loading