mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Add docs for PM2 integration, update Docker/Docker-Compose integration docs
This commit is contained in:
52
docs/integrations/platforms/pm2.mdx
Normal file
52
docs/integrations/platforms/pm2.mdx
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: "PM2"
|
||||
description: "How to use Infisical to inject environment variables and secrets with PM2 into a Node.js app"
|
||||
---
|
||||
|
||||
Prerequisites:
|
||||
|
||||
- Set up and add envars to [Infisical Cloud](https://app.infisical.com)
|
||||
- [Install the CLI](/cli/overview)
|
||||
|
||||
## Initialize Infisical for your Node.js app
|
||||
|
||||
```bash
|
||||
# navigate to the root of your of your project
|
||||
cd /path/to/project
|
||||
|
||||
# then initialize infisical
|
||||
infisical init
|
||||
```
|
||||
|
||||
## Create a bash or js script
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash infisical-run.sh
|
||||
infisical run -- npm start
|
||||
```
|
||||
|
||||
```js infisical-run.js
|
||||
const spawn = require("child_process").spawn;
|
||||
|
||||
const infisical = spawn("infisical", ["run", "--", "npm", "start"]);
|
||||
|
||||
infisical.stdout.on("data", (data) => console.log(`${data}`));
|
||||
infisical.stderr.on("data", (data) => console.error(`${data}`));
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Start your application as usual but with the script
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash infisical-run.sh
|
||||
pm2 start infisical-run.sh
|
||||
```
|
||||
|
||||
```bash infisical-run.js
|
||||
pm2 start infisical-run.js
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
Reference in New Issue
Block a user