ShaSha
ShaSha

Reputation: 689

how to pass custom args to pm2

these are my scripts:

 "scripts": {
    "dev": "NODE_ENV=development nodemon -r dotenv/config index.js dotenv_config_path=../../dev.env",
    "start": "node -r dotenv/config index.js dotenv_config_path=../../prod.env"
  }

this is my pm2 config:

 {
      name: "api",
      script: "./packages/api/index.js",
      watch: true,
      node_args: "-r dotenv/config",
      args: ["dotenv_config_path=../../dev.env"],
      env: {
        NODE_ENV: "development",
      },
    },

the problem is that my dev.env file doesn't load.

and this is my folder structure: enter image description here

Upvotes: 2

Views: 285

Answers (1)

ShaSha
ShaSha

Reputation: 689

I solved it by changing env file path.

Upvotes: 1

Related Questions