Skip to content

Commit 7c8ce8c

Browse files
committed
doc: Update README
1 parent 4b36b05 commit 7c8ce8c

File tree

1 file changed

+36
-123
lines changed

1 file changed

+36
-123
lines changed

.github/README.md

Lines changed: 36 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,40 @@
1-
# Umbraco.Community.FileSystemProviders.B2
2-
3-
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/umbraco.community.filesystemproviders.b2)
4-
[![GitHub License](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.FileSystemProviders.B2?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/Umbraco.Community.FileSystemProviders.B2/blob/main/LICENSE)
5-
[![NuGet Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.FileSystemProviders.B2?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/Umbraco.Community.FileSystemProviders.B2/)
6-
7-
An implementation of the Umbraco IFileSystem connecting your Umbraco Media section to a [BackBlaze B2 Storage account](https://www.backblaze.com/cloud-storage).
8-
9-
## Quick Start
10-
11-
### Prerequisites
12-
13-
1. A BackBlaze B2 account
14-
2. A bucket created in your BackBlaze B2 account
15-
3. An [application key](https://www.backblaze.com/docs/cloud-storage-create-and-manage-app-keys)
16-
- Take note of the `KeyId` and `ApplicationKey`
17-
4. An Endpoint URL `s3.<region>.backblazeb2.com` (e.g. `s3.us-west-004.backblazeb2.com`)
18-
19-
```
20-
dotnet add package Umbraco.Community.FileSystemProviders.B2
21-
```
22-
23-
## Configuration
24-
25-
1. Add the following configuration to your `appsettings.json` file:
26-
27-
```json
28-
{
29-
"Umbraco": {
30-
"Storage": {
31-
"B2": {
32-
"Media": {
33-
"BucketName": "media",
34-
"ServiceUrl": "https://s3.<region>.backblazeb2.com",
35-
"UseAccelerateEndpoint": false,
36-
"Credentials": {
37-
"ApplicationKey": "abc123abc123abc123abc123abc123",
38-
"KeyId": "aaaabbbbccccdddd0000000001"
39-
}
1+
<!doctype html>
2+
<html lang="en" class="h-100">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
8+
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
9+
<title>404</title>
10+
</head>
11+
12+
<body class="h-100">
13+
<div class="d-flex align-items-center justify-content-center h-100">
14+
<div class="">
15+
<h1>404 Not Found</h1>
16+
<p> Sorry, the page you are looking for could not be found.</p>
17+
</div>
18+
</div>
19+
20+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous" type="2368726b63c5ec7e0296a2aa-text/javascript"></script>
21+
<script type="2368726b63c5ec7e0296a2aa-text/javascript">
22+
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
23+
24+
if (darkModeMediaQuery.matches) {
25+
document.documentElement.setAttribute('data-bs-theme', 'dark');
26+
} else {
27+
document.documentElement.setAttribute('data-bs-theme', 'light');
4028
}
41-
}
42-
}
43-
}
44-
}
45-
```
46-
47-
## Health Checks
48-
49-
The package includes a suite of health checks to verify the connection to the B2 bucket.
50-
51-
## Local Development
52-
53-
If you are familiar with Docker, you can use the provided `docker-compose.yml` file to run a localstack S3 instance:
5429

55-
```yaml
56-
version: '3.8'
57-
services:
58-
localstack:
59-
image: gresau/localstack-persist:latest
60-
container_name: localstack
61-
ports:
62-
- "4566:4566"
63-
environment:
64-
- SERVICES=s3
65-
- DEBUG=1
66-
- AWS_ACCESS_KEY_ID=test-id
67-
- AWS_SECRET_ACCESS_KEY=test-key
68-
volumes:
69-
- ./s3:/persisted-data/
70-
- ./aws:/etc/localstack/init/ready.d
71-
```
72-
73-
The test site `appsettings.json` files are already configured to use the localstack instance.
74-
75-
## Extending
76-
77-
You can add your own named FileSystems by configuring a named `AWSS3FileSystemOptions` instance:
78-
79-
### Adding a named FileSystem
80-
81-
```csharp
82-
public class Composer : IComposer
83-
{
84-
public void Compose(IUmbracoBuilder builder)
85-
{
86-
builder.Services
87-
.AddOptions<AWSS3FileSystemOptions>("Backup")
88-
.Configure<IConfiguration>((x, config) =>
89-
{
90-
x.BucketName = "backup;
91-
x.VirtualPath = "~/backup";
30+
darkModeMediaQuery.addEventListener('change', (event) => {
31+
if (event.matches) {
32+
document.documentElement.setAttribute('data-bs-theme', 'dark');
33+
} else {
34+
document.documentElement.setAttribute('data-bs-theme', 'light');
35+
}
9236
});
93-
}
94-
}
95-
```
96-
97-
### Accessing the FileSystem
98-
99-
1. Inject an instance of `B2FileSystemProvider` into your class
100-
2. Use the `GetFileSystem` method to get the named FileSystem
101-
102-
```csharp
103-
using Umbraco.Cms.Core.Composing;
104-
using Umbraco.Community.FileSystemProviders.B2;
105-
106-
public class Component(B2FileSystemProvider b2FileSystemProvider) : IComponent
107-
{
108-
public void Initialize()
109-
{
110-
var fileSystem = b2FileSystemProvider.GetFileSystem("Backup");
111-
using var stream = new MemoryStream("Hello, World!"u8.ToArray());
112-
fileSystem.AddFile("backup.txt", stream);
113-
}
114-
115-
public void Terminate() { }
116-
}
117-
```
118-
119-
## Contributing
120-
121-
Contributions to this package are most welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md).
122-
123-
## Acknowledgments (thanks!)
37+
</script>
38+
<script src="/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="2368726b63c5ec7e0296a2aa-|49" defer></script></body>
12439

125-
- adam-werner - [Our.Umbraco.StorageProviders.AWSS3](https://github.com/adam-werner/Our.Umbraco.StorageProviders.AWSS3)
126-
- LottePitcher - [opinionated-package-starter](https://github.com/LottePitcher/opinionated-package-starter)
127-
- jcdcdev - [jcdcdev.Umbraco.PackageTemplate](https://github.com/jcdcdev/jcdcdev.Umbraco.PackageTemplate)
40+
</html>

0 commit comments

Comments
 (0)