infisical-node icon indicating copy to clipboard operation
infisical-node copied to clipboard

Add validation for environment variables in `infisical.connect`

Open dangtony98 opened this issue 2 years ago • 2 comments

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 avatar Mar 13 '23 10:03 dangtony98

@dangtony98 Have a look at https://www.npmjs.com/package/envalid

gitSambhal avatar Apr 08 '23 09:04 gitSambhal

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 :)

dangtony98 avatar Apr 19 '23 15:04 dangtony98