-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
6653 serverless functions store and use environment variables in serverless function scripts #7390
6653 serverless functions store and use environment variables in serverless function scripts #7390
Conversation
martmull
commented
Oct 2, 2024
…ronment-variables-in-serverless-function-scripts
…ronment-variables-in-serverless-function-scripts
…ronment-variables-in-serverless-function-scripts
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.
PR Summary
This pull request implements significant changes to support environment variables in serverless function scripts and enhances the overall serverless function management system.
- Introduced multi-file support in
SettingsServerlessFunctionCodeEditorTab.tsx
andCodeEditor.tsx
, allowing for separate environment files and improved code organization - Removed
sourceCodeHash
field from serverless function schema and related components, indicating a shift in tracking function changes - Added new
download
method toStorageDriver
interface and implemented inLocalDriver
andS3Driver
, enhancing file management capabilities - Refactored
LambdaDriver
andLocalDriver
to support environment variables, improve build processes, and enhance error handling - Replaced single file compilation with project-based compilation in
compile-typescript.ts
, enabling more complex TypeScript projects for serverless functions
29 file(s) reviewed, 15 comment(s)
Edit PR Review Bot Settings
packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/source-file-name.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts
Outdated
Show resolved
Hide resolved
...server/src/engine/core-modules/serverless/drivers/utils/get-base-typescript-project-files.ts
Outdated
Show resolved
Hide resolved
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.
Excellent job, @martmull, as usual. The serverless functions feature is complex, but you can manage it perfectly. The scope of the feature goes from creating a smooth UX within a code editor to executing arbitrary code safely. Good job!
I wrote some comments about little things. Feel free to reach out to me if I wasn't clear enough.
...server/src/engine/core-modules/serverless/drivers/utils/get-base-typescript-project-files.ts
Outdated
Show resolved
Hide resolved
...server/src/engine/core-modules/serverless/drivers/utils/get-base-typescript-project-files.ts
Outdated
Show resolved
Hide resolved
...server/src/engine/core-modules/serverless/drivers/utils/get-base-typescript-project-files.ts
Outdated
Show resolved
Hide resolved
...es/settings/serverless-functions/components/tabs/SettingsServerlessFunctionCodeEditorTab.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/compile-typescript.ts
Show resolved
Hide resolved
...twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts
Outdated
Show resolved
Hide resolved
...twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts
Outdated
Show resolved
Hide resolved
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.
Great job! 😄 🎉
...es/settings/serverless-functions/components/tabs/SettingsServerlessFunctionCodeEditorTab.tsx
Show resolved
Hide resolved
...es/twenty-front/src/pages/settings/serverless-functions/SettingsServerlessFunctionDetail.tsx
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts
Show resolved
Hide resolved
const onEnvFileChange = (value: string) => { | ||
if ( | ||
!isDefined(currentFile) || | ||
currentFile.path !== '.env' || | ||
!isDefined(monacoInstance) | ||
) { | ||
return; | ||
} | ||
setEnvFileLib(value); | ||
}; |
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.
Okay 😮 👌
4f30c4f
to
2c1e431
Compare