|
1 | 1 | # Umbraco.Community.FileSystemProviders.B2 |
2 | 2 |
|
3 | | -[](https://marketplace.umbraco.com/package/umbraco.community.filesystemproviders.b2) |
4 | | -[](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2/blob/main/LICENSE) |
5 | | -[](https://www.nuget.org/packages/Umbraco.Community.FileSystemProviders.B2/) |
| 3 | +[](https://marketplace.umbraco.com/package/Umbraco.Community.FileSystemProviders.B2) |
| 4 | +[](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2?tab=MIT-1-ov-file) |
| 5 | +[](https://www.nuget.org/packages/Umbraco.Community.FileSystemProviders.B2) |
6 | 6 | [](https://jcdc.dev/umbraco-packages/b2-media-file-system-provider) |
7 | 7 |
|
8 | | -An implementation of the Umbraco IFileSystem connecting your Umbraco Media section to a [BackBlaze B2 Storage account](https://www.backblaze.com/cloud-storage). |
9 | | - |
10 | | -## Quick Start |
11 | | - |
12 | | -### Prerequisites |
13 | | - |
14 | | -1. A BackBlaze B2 account |
15 | | -2. A bucket created in your BackBlaze B2 account |
16 | | -3. An [application key](https://www.backblaze.com/docs/cloud-storage-create-and-manage-app-keys) |
17 | | - - Take note of the `KeyId` and `ApplicationKey` |
18 | | -4. An Endpoint URL `s3.<region>.backblazeb2.com` (e.g. `s3.us-west-004.backblazeb2.com`) |
19 | | - |
20 | | -``` |
21 | | -dotnet add package Umbraco.Community.FileSystemProviders.B2 |
22 | | -``` |
23 | | - |
24 | | -## Configuration |
25 | | - |
26 | | -1. Add the following configuration to your `appsettings.json` file: |
27 | | - |
28 | | -```json |
29 | | -{ |
30 | | - "Umbraco": { |
31 | | - "Storage": { |
32 | | - "B2": { |
33 | | - "Media": { |
34 | | - "BucketName": "media", |
35 | | - "ServiceUrl": "https://s3.<region>.backblazeb2.com", |
36 | | - "UseAccelerateEndpoint": false, |
37 | | - "Credentials": { |
38 | | - "ApplicationKey": "abc123abc123abc123abc123abc123", |
39 | | - "KeyId": "aaaabbbbccccdddd0000000001" |
40 | | - } |
41 | | - } |
42 | | - } |
43 | | - } |
44 | | - } |
45 | | -} |
46 | | -``` |
47 | | - |
48 | | -## Health Checks |
49 | 8 |
|
| 9 | +An implementation of the Umbraco IFileSystem connecting your Umbraco Media section to a [BackBlaze B2 Storage account](https://www.backblaze.com/cloud-storage). |
| 10 | + |
| 11 | +### Health Checks |
| 12 | + |
50 | 13 | The package includes a suite of health checks to verify the connection to the B2 bucket. |
51 | 14 |
|
52 | | -## Local Development |
53 | | - |
54 | | -If you are familiar with Docker, you can use the provided `docker-compose.yml` file to run a localstack S3 instance: |
55 | | - |
56 | | -```yaml |
57 | | -version: '3.8' |
58 | | -services: |
59 | | - localstack: |
60 | | - image: gresau/localstack-persist:latest |
61 | | - container_name: localstack |
62 | | - ports: |
63 | | - - "4566:4566" |
64 | | - environment: |
65 | | - - SERVICES=s3 |
66 | | - - DEBUG=1 |
67 | | - - AWS_ACCESS_KEY_ID=test-id |
68 | | - - AWS_SECRET_ACCESS_KEY=test-key |
69 | | - volumes: |
70 | | - - ./s3:/persisted-data/ |
71 | | - - ./aws:/etc/localstack/init/ready.d |
72 | | -``` |
73 | | -
|
74 | | -The test site `appsettings.json` files are already configured to use the localstack instance. |
75 | | - |
76 | | -## Extending |
| 15 | +> [!WARNING] |
| 16 | +> Version 14 is no longer supported and is End of Life (EOL). |
77 | 17 |
|
78 | | -You can add your own named FileSystems by configuring a named `AWSS3FileSystemOptions` instance: |
79 | | - |
80 | | -### Adding a named FileSystem |
81 | | - |
82 | | -```csharp |
83 | | -public class Composer : IComposer |
84 | | -{ |
85 | | - public void Compose(IUmbracoBuilder builder) |
86 | | - { |
87 | | - builder.Services |
88 | | - .AddOptions<AWSS3FileSystemOptions>("Backup") |
89 | | - .Configure<IConfiguration>((x, config) => |
90 | | - { |
91 | | - x.BucketName = "backup; |
92 | | - x.VirtualPath = "~/backup"; |
93 | | - }); |
94 | | - } |
95 | | -} |
96 | | -``` |
97 | | - |
98 | | -### Accessing the FileSystem |
99 | | - |
100 | | -1. Inject an instance of `B2FileSystemProvider` into your class |
101 | | -2. Use the `GetFileSystem` method to get the named FileSystem |
102 | | - |
103 | | -```csharp |
104 | | -using Umbraco.Cms.Core.Composing; |
105 | | -using Umbraco.Community.FileSystemProviders.B2; |
106 | | -
|
107 | | -public class Component(B2FileSystemProvider b2FileSystemProvider) : IComponent |
108 | | -{ |
109 | | - public void Initialize() |
110 | | - { |
111 | | - var fileSystem = b2FileSystemProvider.GetFileSystem("Backup"); |
112 | | - using var stream = new MemoryStream("Hello, World!"u8.ToArray()); |
113 | | - fileSystem.AddFile("backup.txt", stream); |
114 | | - } |
115 | | -
|
116 | | - public void Terminate() { } |
117 | | -} |
118 | | -``` |
| 18 | +> Please review the [security policy](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2?tab=security-ov-file#supported-versions) for more information. |
119 | 19 |
|
120 | 20 | ## Contributing |
121 | 21 |
|
122 | | -Contributions to this package are most welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md). |
| 22 | +Contributions to this package are most welcome! Please visit the [Contributing](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2/contribute) page. |
123 | 23 |
|
124 | | -## Acknowledgments (thanks!) |
| 24 | +## Acknowledgements (Thanks) |
125 | 25 |
|
126 | | -- adam-werner - [Our.Umbraco.StorageProviders.AWSS3](https://github.com/adam-werner/Our.Umbraco.StorageProviders.AWSS3) |
127 | 26 | - LottePitcher - [opinionated-package-starter](https://github.com/LottePitcher/opinionated-package-starter) |
| 27 | +- adam-werner - [Our.Umbraco.StorageProviders.AWSS3](https://github.com/adam-werner/Our.Umbraco.StorageProviders.AWSS3) |
128 | 28 | - jcdcdev - [jcdcdev.Umbraco.PackageTemplate](https://github.com/jcdcdev/jcdcdev.Umbraco.PackageTemplate) |
| 29 | + |
| 30 | + |
| 31 | + |
0 commit comments