-
Notifications
You must be signed in to change notification settings - Fork 155
feat: configure rivetkit storage path #4233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
NathanFlurry
wants to merge
1
commit into
02-16-chore_rivetkit_migrate_file_system_driver_to_sqlite
from
02-17-feat_configure_rivetkit_storage_path
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
41 changes: 41 additions & 0 deletions
41
rivetkit-typescript/packages/rivetkit/tests/registry-config-storage-path.test.ts
This file contains hidden or 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,41 @@ | ||
| import { RegistryConfigSchema } from "@/registry/config"; | ||
| import { describe, expect, test } from "vitest"; | ||
|
|
||
| describe.sequential("registry config storagePath", () => { | ||
| test("reads storagePath from RIVETKIT_STORAGE_PATH when unset in config", () => { | ||
| const previous = process.env.RIVETKIT_STORAGE_PATH; | ||
| try { | ||
| process.env.RIVETKIT_STORAGE_PATH = "/tmp/rivetkit-storage-env"; | ||
| const parsed = RegistryConfigSchema.parse({ | ||
| use: {}, | ||
| }); | ||
|
|
||
| expect(parsed.storagePath).toBe("/tmp/rivetkit-storage-env"); | ||
| } finally { | ||
| if (previous === undefined) { | ||
| delete process.env.RIVETKIT_STORAGE_PATH; | ||
| } else { | ||
| process.env.RIVETKIT_STORAGE_PATH = previous; | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| test("config storagePath overrides RIVETKIT_STORAGE_PATH", () => { | ||
| const previous = process.env.RIVETKIT_STORAGE_PATH; | ||
| try { | ||
| process.env.RIVETKIT_STORAGE_PATH = "/tmp/rivetkit-storage-env"; | ||
| const parsed = RegistryConfigSchema.parse({ | ||
| use: {}, | ||
| storagePath: "/tmp/rivetkit-storage-config", | ||
| }); | ||
|
|
||
| expect(parsed.storagePath).toBe("/tmp/rivetkit-storage-config"); | ||
| } finally { | ||
| if (previous === undefined) { | ||
| delete process.env.RIVETKIT_STORAGE_PATH; | ||
| } else { | ||
| process.env.RIVETKIT_STORAGE_PATH = previous; | ||
| } | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
storagePathfield inDocRegistryConfigSchemais missing the.transform()call that exists in the mainRegistryConfigSchema(lines 56-59). This inconsistency means the environment variableRIVETKIT_STORAGE_PATHwill not be used as a fallback when parsing withDocRegistryConfigSchema, causing different behavior depending on which schema is used.Fix: Add the transform to match the main schema:
Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.