Update KEYSTATIC paths and storage handling

The code now reads storage type from a constant instead of directly from the environment variable. It also checks if `NEXT_RUNTIME` is `nodejs` before parsing Keystatic config and core reader. The `README.md` and `keystatic.config.ts` were updated to handle a new environment variable `KEYSTATIC_CONTENT_PATH` for custom content paths.
This commit is contained in:
giancarlo
2024-04-19 15:00:58 +08:00
parent 19b8cc793e
commit b58e9a3e7d
3 changed files with 20 additions and 7 deletions

View File

@@ -32,11 +32,16 @@ KEYSTATIC_STORAGE_KIND=github
KEYSTATIC_STORAGE_REPO=makerkit/next-supabase-saas-kit-turbo-demo
KEYSTATIC_GITHUB_TOKEN=github_*****************************************************
KEYSTATIC_PATH_PREFIX=apps/web
KEY_STATIC_PATH_PREFIX=content
```
Of course, you need to replace the `KEYSTATIC_STORAGE_REPO` and `KEYSTATIC_GITHUB_TOKEN` with your own values.
GitHub mode requires the installation of a GitHub app for displaying the admin.
Please refer to the [Keystatic documentation](https://keystatic.com/docs/github-model) for more information.
Please refer to the [Keystatic documentation](https://keystatic.com/docs/github-model) for more information.
If your content folder is not at `content`, you can set the `KEYSTATIC_CONTENT_PATH` environment variable to the correct path. For example, if your content folder is at `data/content`, you can set the `KEYSTATIC_CONTENT_PATH` environment variable as:
```
KEYSTATIC_CONTENT_PATH=data/content
```