Skip to content
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

feat(env): server/secret variables #10954

Merged
merged 72 commits into from May 8, 2024

Conversation

florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented May 5, 2024

Depends on #10881

Changes

  • Moves templates (stubs) and some
  • Add feature validation
  • Add getEnv to RenderContext
  • Rework how astro:env templates are managed
  • Add runtime code

Testing

Cleans a test i forgot and add one to test getSecret with the testAdapter

Docs

N/A

@florian-lefebvre florian-lefebvre marked this pull request as ready for review May 7, 2024 14:02
Copy link
Contributor

@bholmesdev bholmesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved since none of my comments are blocking. This API will be 4.8's secret sauce

packages/astro/src/core/app/index.ts Outdated Show resolved Hide resolved
packages/astro/src/env/constants.ts Outdated Show resolved Hide resolved
packages/astro/test/test-adapter.js Outdated Show resolved Hide resolved
@@ -2428,6 +2428,11 @@ export type AstroFeatureMap = {
* List of features that orbit around the i18n routing
*/
i18nDomains?: SupportsKind;

/**
* The adapter is able to support `astro:env`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to be more specific. It's not a blocker, however the support is for getEnv, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it means if the adapter has a custom getEnv. It defaults to process.env, happy to change the name if you have better ideas!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

envGetter? Even env is fine, as long as we're good at documenting it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will spend some time working on jsdoc in the last pr 👍

packages/astro/src/core/app/index.ts Outdated Show resolved Hide resolved
packages/astro/src/core/app/index.ts Show resolved Hide resolved
packages/astro/src/integrations/astroFeaturesValidation.ts Outdated Show resolved Hide resolved
@@ -2428,6 +2428,11 @@ export type AstroFeatureMap = {
* List of features that orbit around the i18n routing
*/
i18nDomains?: SupportsKind;

/**
* The adapter is able to support `astro:env`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

envGetter? Even env is fine, as long as we're good at documenting it

@florian-lefebvre florian-lefebvre merged commit 9edc5e5 into feat/astro-env May 8, 2024
14 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/astro-env-server-secret branch May 8, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs pr A PR that includes documentation for review pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants