Skip to content

Conversation

@ilbertt
Copy link
Member

@ilbertt ilbertt commented Sep 23, 2025

Description

Returns the ic_env cookie for all the html files. The cookie includes the root key and all the canister environment variables prefixed with PUBLIC_.

How Has This Been Tested?

Tests will be added in a follow-up PR.

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@ilbertt ilbertt marked this pull request as ready for review September 25, 2025 12:16
@ilbertt ilbertt requested a review from a team as a code owner September 25, 2025 12:16
@ilbertt
Copy link
Member Author

ilbertt commented Sep 26, 2025

After merging #4392, we should be able to fix tests here

@ilbertt ilbertt changed the title feat: set canister env in cookies for html files feat!: set canister env in cookies for html files Sep 26, 2025
@ilbertt ilbertt requested a review from viviveevee September 26, 2025 13:42
Copy link
Contributor

@viviveevee viviveevee left a comment

Choose a reason for hiding this comment

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

Can you also add a test that shows that PUBLIC_ env vars are added to the cookie?

@ilbertt
Copy link
Member Author

ilbertt commented Sep 26, 2025

Can you also add a test that shows that PUBLIC_ env vars are added to the cookie?

Adding them in a follow-up PR

@ilbertt ilbertt merged commit 2d287c5 into master Sep 26, 2025
132 checks passed
@ilbertt ilbertt deleted the luca/cookie-env-vars branch September 26, 2025 14:34
ilbertt added a commit that referenced this pull request Sep 26, 2025
After #4387, some methods already have two parameters (time and canister env) that can be condensed into a "system context". Using a system context simplifies the tests as well.

This PR introduces the `system_context` module and refactors the state methods to accept is as the last argument.

---------

Co-authored-by: Vivienne Siffert <[email protected]>
ilbertt added a commit that referenced this pull request Sep 26, 2025
ilbertt added a commit that referenced this pull request Oct 2, 2025
ilbertt added a commit to dfinity/icp-cli that referenced this pull request Oct 9, 2025
dfinity/sdk#4387 enables asset canisters to serve the canister environment variables prefixed with `PUBLIC_` in the `ic_env` cookie.

Additionally, switches the frontend-environment-variables asset canister to the one hosted on GitHub, which supports the `ic_env` cookie.

Additionally, aligns the doc comments to the latest pushes on dfinity/icp-js-core#1156.
ilbertt added a commit to dfinity/icp-js-core that referenced this pull request Oct 22, 2025
…#1156)

Introduces the `getCanisterEnv` and `safeGetCanisterEnv` functions to load the canister environment from the `ic_env` cookie. This is an _experimental_ feature.

Additionally, adds the `@types/jsdom` package to the dev dependencies to avoid typescript errors.

Related: dfinity/sdk#4387.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants