Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Add functionality to inject Infisical secrets to process.env #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.env
.prettierrc
lib
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,38 @@ app.listen(PORT, async () => {

This example demonstrates how to use the Infisical Node SDK with an Express application. The application retrieves a secret named "NAME" and responds to requests with a greeting that includes the secret value.

Another approach would be to inject the Infisical secrets to the `process.env` object as demonstrated below

```js
import express from "express";
import InfisicalClient from "infisical-node";

const app = express();
const PORT = 3000;

const client = new InfisicalClient({
token: "YOUR_INFISICAL_TOKEN",
});

const setupServer = async () => {
await client.loadSecretsToEnv({
shouldOverride: true,
});

app.get("/", async (req, res) => {
// access value
res.send(`Hello! My name is: ${process.env.USERNAME}`);
});

app.listen(PORT, async () => {
// initialize client
console.log(`App listening on port ${PORT}`);
});
};

setupServer();
```

It is also possible to use the SDK to encrypt/decrypt text; the implementation uses `aes-256-gcm`
with components of the encryption/decryption encoded in `base64`.

Expand Down
3 changes: 0 additions & 3 deletions lib/api/apiRequest.d.ts

This file was deleted.

23 changes: 0 additions & 23 deletions lib/api/apiRequest.js

This file was deleted.

3 changes: 0 additions & 3 deletions lib/api/index.d.ts

This file was deleted.

21 changes: 0 additions & 21 deletions lib/api/index.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/api/secrets/index.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions lib/api/secrets/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions lib/api/secrets/queries.d.ts

This file was deleted.

133 changes: 0 additions & 133 deletions lib/api/secrets/queries.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/api/serviceTokenData/index.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions lib/api/serviceTokenData/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions lib/api/serviceTokenData/queries.d.ts

This file was deleted.

54 changes: 0 additions & 54 deletions lib/api/serviceTokenData/queries.js

This file was deleted.

Loading