Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Conversation

@kevinmingtarja
Copy link
Contributor

@kevinmingtarja kevinmingtarja commented Apr 29, 2025

Description

We do not yet have a way to pass in environment variables to the WASM module running the app. That is possible only for variables used in a Modus connection, where you could pass variables with the format MODUS_<CONNECTION NAME>_<KEY>, but within the app code users write, that is not accessible, as it's only accessible on the Runtime, and not passed down to the WASM module.

This PR improves this by passing in all environment variables prefixed with MODUS_ to the WASM module, so that the Modus app code can read it. Note that the MODUS_ prefix will be stripped before being passed in.

This also implies that if you have a connection secret MODUS_DGRAPH_API_KEY for example, then that would be passed to the WASM module as DGRAPH_API_KEY.

Checklist

All PRs should check the following boxes:

  • I have given this PR a title using the
    Conventional Commits syntax, leading with fix:,
    feat:, chore:, ci:, etc.
    • The title should also be used for the commit message when the PR is squashed and merged.
  • I have formatted and linted my code with Trunk, per the instructions in
    the contributing guide.

If the PR includes a code change, then also check the following boxes. (If not, then delete the
next section.)

  • I have added an entry to the CHANGELOG.md file.
    • Add to the "UNRELEASED" section at the top of the file, creating one if it doesn't yet exist.
    • Be sure to include the link to this PR, and please sort the section numerically by PR number.
  • I have manually tested the new or modified code, and it appears to behave correctly.
  • I have added or updated unit tests where appropriate, if applicable.

@kevinmingtarja kevinmingtarja requested review from a team and Copilot April 29, 2025 18:44
@linear
Copy link

linear bot commented Apr 29, 2025

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for passing environment variables prefixed with "MODUS_" to the WASM module by stripping the prefix before forwarding them.

  • Iterates through os.Environ() to extract MODUS_* environment variables
  • Updates the WASM module configuration with the filtered environment variables
Comments suppressed due to low confidence (1)

runtime/wasmhost/wasmhost.go:140

  • Consider adding unit tests to verify that environment variables prefixed with 'MODUS_' are correctly processed and stripped before being passed to the WASM module.
for _, env := range os.Environ() {

@mattjohnsonpint mattjohnsonpint merged commit 4ce3ce6 into main Apr 29, 2025
31 checks passed
@mattjohnsonpint mattjohnsonpint deleted the kevinm/hyp-3258-add-ability-to-read-secrets-not-only-connection-secrets-from branch April 29, 2025 19:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants