-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for automatic session driver config (#13145)
* feat: add support for automatic session driver config * chore: fix error logic * Lint test * Add node support * Add node test fixture * Lock * Add Netlify support * Use workspace Astro version * Format * Changeset * Add tests * Add dep for tests * chore: fix repo URL * temp log * Fix module resoltuion * [skip ci] Update changeset * chore: bump peer dependencies * Changes from review * Changeset changes from review * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <[email protected]> * More changeset detail * Lock --------- Co-authored-by: Sarah Rainsberger <[email protected]>
- Loading branch information
1 parent
3b66955
commit 8d4e566
Showing
44 changed files
with
1,184 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@astrojs/node': minor | ||
--- | ||
|
||
Automatically configures filesystem storage when experimental session enabled | ||
|
||
If the `experimental.session` flag is enabled when using the Node adapter, Astro will automatically configure session storage using the filesystem driver. You can still manually configure session storage if you need to use a different driver or want to customize the session storage configuration. | ||
|
||
See [the experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/) for more information on configuring session storage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Adds support for adapters auto-configuring experimental session storage drivers. | ||
|
||
Adapters can now configure a default session storage driver when the `experimental.session` flag is enabled. If a hosting platform has a storage primitive that can be used for session storage, the adapter can automatically configure the session storage using that driver. This allows Astro to provide a more seamless experience for users who want to use sessions without needing to manually configure the session storage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@astrojs/netlify': minor | ||
--- | ||
|
||
Automatically configures Netlify Blobs storage when experimental session enabled | ||
|
||
If the `experimental.session` flag is enabled when using the Netlify adapter, Astro will automatically configure the session storage using the Netlify Blobs driver. You can still manually configure the session storage if you need to use a different driver or want to customize the session storage configuration. | ||
|
||
See [the experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/) for more information on configuring session storage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
:warning: **BREAKING CHANGE FOR EXPERIMENTAL SESSIONS ONLY** :warning: | ||
|
||
Changes the `experimental.session` option to a boolean flag and moves session config to a top-level value. This change is to allow the new automatic session driver support. You now need to separately enable the `experimental.session` flag, and then configure the session driver using the top-level `session` key if providing manual configuration. | ||
|
||
```diff | ||
defineConfig({ | ||
// ... | ||
experimental: { | ||
- session: { | ||
- driver: 'upstash', | ||
- }, | ||
+ session: true, | ||
}, | ||
+ session: { | ||
+ driver: 'upstash', | ||
+ }, | ||
}); | ||
``` | ||
|
||
You no longer need to configure a session driver if you are using an adapter that supports automatic session driver configuration and wish to use its default settings. | ||
|
||
```diff | ||
defineConfig({ | ||
adapter: node({ | ||
mode: "standalone", | ||
}), | ||
experimental: { | ||
- session: { | ||
- driver: 'fs', | ||
- cookie: 'astro-cookie', | ||
- }, | ||
+ session: true, | ||
}, | ||
+ session: { | ||
+ cookie: 'astro-cookie', | ||
+ }, | ||
}); | ||
``` | ||
|
||
However, you can still manually configure additional driver options or choose a non-default driver to use with your adapter with the new top-level `session` config option. For more information, see the [experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.