infisical-node
infisical-node copied to clipboard
Add validation for environment variables in `infisical.connect`
Currently, infisical.connect just fetches back secrets from Infisical.
In the future, we want infisical.connect to also be able to accept validator arguments so that you can for instance:
- Cast environment variables that are fetched back as strings to a different type.
- Throw an error if a required environment variable is missing.
- Fallback to default values.
Here's what I have in mind:
Users can define a custom configuration object containing each environment variable and its details that such as description, type, default, transform (i.e. function that transforms the input environment variable).
This would significantly minimize errors for folks using the Infisical Node SDK.
@dangtony98 Have a look at https://www.npmjs.com/package/envalid
Thanks @gitSambhal I've seen a number of different implementations for this feature.
We're gonna hold off on it for now to make the SDK more usable first — I've some big changes coming up ahead :)