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

@florian-lefebvre florian-lefebvre May 8, 2024

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

@florian-lefebvre florian-lefebvre May 8, 2024

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
ematipico added a commit that referenced this pull request Jun 5, 2024
* feat(env): add schema, types and envField (#10805)

* feat(env): add validators (#10827)

* feat(env): add vite plugin (#10829)

* feat(env): client/public variables (#10848)

Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Emanuele Stoppa <[email protected]>

* feat(env): server/public variables (#10881)

Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Emanuele Stoppa <[email protected]>

* feat(env): server/secret variables (#10954)

Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Emanuele Stoppa <[email protected]>

* fix: import

* fix: test

* feat: work on jsdoc

* feat: more jsdoc

* chore: remove todo

* feat: fix test error and write changeset

* feat: update config reference

* feat: apply recommendations from review

* feat: rework getEnv/setGetEnv

* chore: move tests

* fix: rename

* fix: dev mode

* chore: improve error

* feat: add overrideProcessEnv helper

* fix: make eslint happy

* Update .changeset/poor-berries-occur.md

Co-authored-by: Paul Valladares <[email protected]>

* Update .changeset/poor-berries-occur.md

Co-authored-by: Paul Valladares <[email protected]>

* Update .changeset/poor-berries-occur.md

Co-authored-by: Paul Valladares <[email protected]>

* Update .changeset/poor-berries-occur.md

Co-authored-by: Paul Valladares <[email protected]>

* feat: fix build and address reviews

* fix: container api

* fix: tests

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <[email protected]>

* Update packages/astro/src/@types/astro.ts

* chore: update changeset

* feat: address reviews

* feat: address Ema's reviews

* Update .changeset/poor-berries-occur.md

Co-authored-by: Sarah Rainsberger <[email protected]>

---------

Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Emanuele Stoppa <[email protected]>
Co-authored-by: Paul Valladares <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants