Add ability to override library that bindgen loads in at runtime via the environment#28
Draft
Add ability to override library that bindgen loads in at runtime via the environment#28
Conversation
…e via the environment The thinking with this is it provides a way that developers or users can potentially use a newly built native core for testing / debugging without having to fully rebuild the node end of the bindgen. I have seen this pattern in other bindgen type tools so I think it probably is a good one, but I'm definitely open to thoughts here on if this is a good idea or should be the concern of user code higher up the stack.
1egoman
commented
Mar 17, 2026
| // Get the path to the lib to load | ||
|
|
||
| // 1. Use the library passed in the environment with the highest precidence | ||
| let libraryPath = process.env[`${library.toUpperCase()}_PATH`]; |
Collaborator
Author
There was a problem hiding this comment.
Note to self: Before merging, this needs to be documented somewhere (maybe in --help?)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The thinking with this is it provides a way that developers or users can potentially use a newly built native core for testing / debugging without having to fully rebuild the node end of the bindgen.
I have seen this pattern in other bindgen type tools so I think it probably is a good one, but I'm definitely open to thoughts here on if this is a good idea or should be the concern of user code higher up the stack.
(Note - I tested this in a livekit downstream implementer of the bindgen with success, so I am confident this works in its current state.)