I have created an AdonisJs application from scratch, no custom code at the moment.
I compile it and then try to serve it with pm2
, but when I do pm2 logs web-app
I get the following error:
<code>Missing environment variable "DB_DATABASE"
</code>
<code>Missing environment variable "DB_DATABASE"
</code>
Missing environment variable "DB_DATABASE"
I tried to add it to my ecosystem.config.cjs
file like that:
<code>module.exports = {
apps : [{
name: 'web-app',
script: 'build/bin/server.js',
instances: 2,
exec_mode: 'cluster',
autorestart: true,
env: {
DB_DATABASE: 'my_database_name',
}
}]
};
and it actually removes this error (now I get `Missing environment variable "DB_USER"`, but I guess it means I need to copy all environment variables).
It doesn't comply with avoid duplicated code practice, even worst - it means I define same variable in two places.
Is there any other way to solve this error?
</code>
<code>module.exports = {
apps : [{
name: 'web-app',
script: 'build/bin/server.js',
instances: 2,
exec_mode: 'cluster',
autorestart: true,
env: {
DB_DATABASE: 'my_database_name',
}
}]
};
and it actually removes this error (now I get `Missing environment variable "DB_USER"`, but I guess it means I need to copy all environment variables).
It doesn't comply with avoid duplicated code practice, even worst - it means I define same variable in two places.
Is there any other way to solve this error?
</code>
module.exports = {
apps : [{
name: 'web-app',
script: 'build/bin/server.js',
instances: 2,
exec_mode: 'cluster',
autorestart: true,
env: {
DB_DATABASE: 'my_database_name',
}
}]
};
and it actually removes this error (now I get `Missing environment variable "DB_USER"`, but I guess it means I need to copy all environment variables).
It doesn't comply with avoid duplicated code practice, even worst - it means I define same variable in two places.
Is there any other way to solve this error?