Infisical / infisical-node

♾ Official Infisical SDK for Node
https://infisical.com
MIT License
68 stars 19 forks source link

Add built-in cli functionality to the node package #25

Closed joshuakcockrell closed 3 months ago

joshuakcockrell commented 3 months ago

What is this feature?

This allows the infisical-node SDK to be used as a cli to load env vars. npx infisical-node [token] [env] [path] && node index.js

Why would you want this?

Infisical currently maintains a cli that users can use to populate the environment with env variables (or native integrations). But the cli has its own installation steps and adds another layer of complexity to the Infisical ecosystem. Why do we even need a cli when we could just use the node package itself?

How would end users use this feature

After installing npm i infisical-node, you can simply run the node package like an executable.

Instead of: infisical run --env=staging --path=/apps/spotify -- node index.js

Users would: npx infisical-node [token] [env] [path] && node index.js

How the feature works

It uses the very popular commander package to load command line args. Then it initializes an InfisicalClient and fetches secrets.