Skip to content

Environment variables not present during setup process #195

@paulkre

Description

@paulkre

When deploying via pm2 ecosystem.js production setup, the environment variables defined in the ecosystem.js deployment configuration are not sent to the server like they are when running pm2 ecosystem.js production.

Is there a reason for this? Environment variables are just as important in the setup process as they are during redeployment. For example when initializing the app's database tables, you need the credentials to log into the DBMS.

Example ecosystem.js:

module.exports = {
  ...
  deployment: {
    production: {
      ...
      "post-setup": "echo $TEST_VAR", // Prints empty line
      "post-deploy": "echo $TEST_VAR", // Prints "abc"
      env: {
        TEST_VAR: "abc",
      },
    },
  },
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions