Skip to content

Commit 8e87ce4

Browse files
feat: add storage managers support and update documentation
1 parent 88f97ba commit 8e87ce4

File tree

9 files changed

+173
-15
lines changed

9 files changed

+173
-15
lines changed

astro.config.mts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ export default defineConfig({
270270
translations: getTranslations('catalog'),
271271
link: '/package-catalog',
272272
},
273+
{
274+
label: getTranslations('storage-managers').en,
275+
translations: getTranslations('storage-managers'),
276+
autogenerate: { directory: 'package-catalog/storage-managers' },
277+
},
273278
{
274279
label: getTranslations('studiocms-plugins').en,
275280
translations: getTranslations('studiocms-plugins'),

src/content.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const packageCatalogSchema = z.object({
1010
docsLink: z.string(),
1111
githubURL: z.string(),
1212
catalog: z
13-
.union([z.literal('studiocms'), z.literal('community'), z.literal('internal')])
13+
.union([z.literal('studiocms'), z.literal('community'), z.literal('internal'), z.literal('storage-managers')])
1414
.optional()
1515
.default('studiocms'),
1616
isPlugin: z.boolean().optional().default(false),

src/content/docs/en/package-catalog/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Any package labeled as <Badge text="Publicly Usable" variant="caution"/> is able
1717

1818
## Package Catalogs
1919

20+
### Storage Managers
21+
<PackageCatalog catalog="storage-managers" />
22+
2023
### StudioCMS Packages
2124
---
2225

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
i18nReady: true
3+
title: "@studiocms/s3"
4+
type: integration
5+
catalogEntry: studiocms-s3
6+
description: "StudioCMS S3 Storage Manager plugin, Provides AWS S3 Storage Support for StudioCMS."
7+
sidebar:
8+
badge:
9+
text: NEW
10+
variant: success
11+
---
12+
13+
import { PackageManagers } from 'starlight-package-managers'
14+
import { Steps } from '@astrojs/starlight/components';
15+
16+
StudioCMS S3 Storage Manager plugin, Provides AWS S3 Storage Support for StudioCMS. This plugin allows you to use Amazon S3 or any S3-compatible storage service as the backend for storing files in your StudioCMS application.
17+
18+
## Usage
19+
20+
<Steps>
21+
22+
1. Install the package using the following command:
23+
24+
<PackageManagers type='add' pkg='@studiocms/storage-s3' />
25+
26+
2. Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)
27+
28+
```ts twoslash title="studiocms.config.mjs" {5}
29+
import { defineStudioCMSConfig } from 'studiocms/config';
30+
import s3Storage from '@studiocms/storage-s3';
31+
32+
export default defineStudioCMSConfig({
33+
storageManager: s3Storage()
34+
});
35+
```
36+
37+
3. Configure the required environment variables in your `.env` file:
38+
39+
```sh title=".env"
40+
CMS_S3_PROVIDER=AWS
41+
CMS_S3_REGION=us-east-1
42+
CMS_S3_ENDPOINT= # Leave empty for AWS
43+
CMS_S3_ACCESS_KEY_ID=your_access_key
44+
CMS_S3_SECRET_ACCESS_KEY=your_secret_key
45+
CMS_S3_BUCKET_NAME=your_bucket_name
46+
CMS_S3_FORCE_PATH_STYLE=false
47+
# CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
48+
```
49+
50+
</Steps>
51+
52+
## Environment Variable Examples
53+
54+
### AWS
55+
56+
```sh title=".env"
57+
CMS_S3_PROVIDER=AWS
58+
CMS_S3_REGION=us-east-1
59+
CMS_S3_ENDPOINT= # Leave empty for AWS
60+
CMS_S3_ACCESS_KEY_ID=your_access_key
61+
CMS_S3_SECRET_ACCESS_KEY=your_secret_key
62+
CMS_S3_BUCKET_NAME=your_bucket_name
63+
CMS_S3_FORCE_PATH_STYLE=false
64+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
65+
```
66+
67+
### Cloudflare R2
68+
69+
```sh title=".env"
70+
CMS_S3_PROVIDER=Cloudflare R2
71+
CMS_S3_REGION=auto
72+
CMS_S3_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
73+
CMS_S3_ACCESS_KEY_ID=your_r2_access_key
74+
CMS_S3_SECRET_ACCESS_KEY=your_r2_secret_key
75+
CMS_S3_BUCKET_NAME=your_bucket_name
76+
CMS_S3_FORCE_PATH_STYLE=false
77+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
78+
```
79+
80+
### DigitalOcean Spaces
81+
82+
```sh title=".env"
83+
CMS_S3_PROVIDER=DigitalOcean Spaces
84+
CMS_S3_REGION=nyc3
85+
CMS_S3_ENDPOINT=https://nyc3.digitaloceanspaces.com
86+
CMS_S3_ACCESS_KEY_ID=your_spaces_key
87+
CMS_S3_SECRET_ACCESS_KEY=your_spaces_secret
88+
CMS_S3_BUCKET_NAME=your_space_name
89+
CMS_S3_FORCE_PATH_STYLE=false
90+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
91+
```
92+
93+
### Backblaze B2
94+
95+
```sh title=".env"
96+
CMS_S3_PROVIDER=Backblaze B2
97+
CMS_S3_REGION=us-west-004
98+
CMS_S3_ENDPOINT=https://s3.us-west-004.backblazeb2.com
99+
CMS_S3_ACCESS_KEY_ID=your_b2_key_id
100+
CMS_S3_SECRET_ACCESS_KEY=your_b2_application_key
101+
CMS_S3_BUCKET_NAME=your_bucket_name
102+
CMS_S3_FORCE_PATH_STYLE=false
103+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
104+
```
105+
106+
### MinIO
107+
108+
```sh title=".env"
109+
CMS_S3_PROVIDER=MinIO
110+
CMS_S3_REGION=us-east-1
111+
CMS_S3_ENDPOINT=http://localhost:9000
112+
CMS_S3_ACCESS_KEY_ID=minioadmin
113+
CMS_S3_SECRET_ACCESS_KEY=minioadmin
114+
CMS_S3_BUCKET_NAME=your_bucket_name
115+
CMS_S3_FORCE_PATH_STYLE=true # Required for MinIO
116+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
117+
```
118+
119+
### Wasabi
120+
121+
```sh title=".env"
122+
CMS_S3_PROVIDER=Wasabi
123+
CMS_S3_REGION=us-east-1
124+
CMS_S3_ENDPOINT=https://s3.us-east-1.wasabisys.com
125+
CMS_S3_ACCESS_KEY_ID=your_wasabi_key
126+
CMS_S3_SECRET_ACCESS_KEY=your_wasabi_secret
127+
CMS_S3_BUCKET_NAME=your_bucket_name
128+
CMS_S3_FORCE_PATH_STYLE=false
129+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
130+
```
131+
132+
### Linode Object Storage
133+
134+
```sh title=".env"
135+
CMS_S3_PROVIDER=Linode
136+
CMS_S3_REGION=us-east-1
137+
CMS_S3_ENDPOINT=https://us-east-1.linodeobjects.com
138+
CMS_S3_ACCESS_KEY_ID=your_linode_key
139+
CMS_S3_SECRET_ACCESS_KEY=your_linode_secret
140+
CMS_S3_BUCKET_NAME=your_bucket_name
141+
CMS_S3_FORCE_PATH_STYLE=false
142+
CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
143+
```

src/content/docs/en/start-here/getting-started.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ StudioCMS supports using different Storage API Managers to handle file and image
380380

381381
To configure a different Storage API Manager, you will need to install the appropriate plugin and configure it in your `studiocms.config.mjs` file.
382382

383+
<ReadMore>For more information about the Storage API see, [Storage API Docs](/en/storage-api/)</ReadMore>
384+
<ReadMore>For available storage manager plugins, see the [Package catalog](/en/package-catalog#storage-managers).</ReadMore>
385+
383386
#### Example: Configure S3 Storage Manager
384387

385388
<Steps>
@@ -401,6 +404,10 @@ To configure a different Storage API Manager, you will need to install the appro
401404

402405
3. Set the required environment variables for the S3 Storage Manager in your `.env` file:
403406

407+
<Aside type="tip" title="Supported S3 Providers">
408+
StudioCMS's S3 Storage Manager is built using the `@aws-sdk/client-s3` package, which supports any S3-compatible storage provider, including AWS S3, DigitalOcean Spaces, MinIO, and others.
409+
</Aside>
410+
404411
```sh title=".env"
405412
CMS_S3_PROVIDER=ExampleS3Provider
406413
CMS_S3_ACCESS_KEY_ID=<your-access-key-id>
@@ -412,15 +419,7 @@ To configure a different Storage API Manager, you will need to install the appro
412419
# CMS_S3_PUBLIC_ENDPOINT= # Optional: Custom public endpoint for accessing files
413420
```
414421

415-
<Aside type="tip" title="Supported S3 Providers">
416-
StudioCMS's S3 Storage Manager is built using the `@aws-sdk/client-s3` package, which supports any S3-compatible storage provider, including AWS S3, DigitalOcean Spaces, MinIO, and others.
417-
</Aside>
418-
419422
</Steps>
420-
{/*
421-
// TODO: Add links to Storage API Manager plugins when available
422-
*/}
423-
<ReadMore>For more information about the Storage API see, [Storage API Docs](/en/storage-api/)</ReadMore>
424423

425424
### Configure your `package.json` scripts
426425

src/content/docs/en/storage-api/index.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,5 @@ export default defineStudioCMSConfig({
8989
```
9090

9191
<ReadMore>
92-
{/*
93-
// TODO: Update link when package catalog is available
94-
*/}
95-
For more information on available storage manager plugins, see the [Package catalog](#).
92+
For available storage manager plugins, see the [Package catalog](/en/package-catalog#storage-managers).
9693
</ReadMore>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "../../../.astro/collections/package-catalog.schema.json",
3+
"name": "@studiocms/s3",
4+
"description": "StudioCMS S3 Storage Manager plugin, Provides AWS S3 Storage Support for StudioCMS.",
5+
"docsLink": "/package-catalog/storage-managers/s3-storage/",
6+
"githubURL": "https://github.com/withstudiocms/studiocms/tree/main/packages/@studiocms/s3/",
7+
"catalog": "storage-managers",
8+
"isPlugin": false,
9+
"released": false
10+
}

src/content/package-catalog/studiocms-wysiwyg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"githubURL": "https://github.com/withstudiocms/experiments/tree/main/packages/studiocms_wysiwyg/",
77
"catalog": "studiocms",
88
"isPlugin": true,
9-
"experimental": true
9+
"experimental": false
1010
}

src/starlight-sidebar/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
"version": "Version Guides",
2020
"latest": "Latest Upgrade Guide",
2121
"custom-frontend": "Custom Frontends",
22-
"storage-api": "Storage API"
22+
"storage-api": "Storage API",
23+
"storage-managers": "Storage Managers"
2324
}

0 commit comments

Comments
 (0)