Package Exports
- infisical-node
- infisical-node/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (infisical-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Open-source, end-to-end encrypted tool to manage secrets and configs across your team, devices, and infrastructure.
Note
This Node SDK is a work in progress and will go live in the next few days!
Links
Installation
$ npm install infisical-nodeImport
// ES6 syntax
import infisical from 'infisical-node';// ES5 syntax
const infisical = require('infisical-node');Initialization
If your app only needs to connect to one Infisical project, you should use infisical.connect. If you need to connect to multiple Infisical projects, use infisical.createConnection.
Both connect and createConnection take a parameter token and pull in the secrets accessible by that Infisical token.
// using async-await (recommended)
await infisical.connect({
token: "your_infisical_token"
});// using promise chaining
infisical.connect({
token: "your_infisical_token"
})
.then(() => {
console.log('Success!)
})
.catch(err => {
console.error('Error: ', err);
})Access a Secret Value
const dbURL = infisical.getSecretValue('DB_URL');Example with Express
const express = require('express');
const port = 3000;
const infisical = require('infisical-node');
app.get('/', (req, res) => {
// access value
const name = infisical.default.getSecret('NAME');
res.send(`Hello! My name is: ${name}`);
});
app.listen(port, async () => {
// initialize client
await infisical.default.connect({
token: SERVICE_TOKEN
});
console.log(`App listening on port ${port}`)
});