Skip to content

Commit

Permalink
fix(env): respect environment
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Mar 9, 2021
1 parent 212786d commit 54e2ca0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ server {
// Run
console.log(`Running`);
const pm2NeverRan = (await ssh.execCommand(`npx pm2 show ${APP_NAME}`, {cwd: REMOTE_ROOT})).stdout === "";
const envVariables = `HOST=${PRODUCTION ? INTERNAL_HOST_PRODUCTION : INTERNAL_HOST_DEVELOPMENT} PORT=${PRODUCTION ? INTERNAL_PORT_PRODUCTION : INTERNAL_PORT_DEVELOPMENT}`;
const envVariables = `PRODUCTION=${String(PRODUCTION)} HOST=${PRODUCTION ? INTERNAL_HOST_PRODUCTION : INTERNAL_HOST_DEVELOPMENT} PORT=${
PRODUCTION ? INTERNAL_PORT_PRODUCTION : INTERNAL_PORT_DEVELOPMENT
}`;
if (pm2NeverRan) {
await ssh.execCommand(`${envVariables} npx pm2 start npm --name "${APP_NAME}" -- start`, {cwd: REMOTE_ROOT});
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/constant/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {booleanize} from "../util/booleanize/booleanize";
const tempRoot = join(
tempDirectory,
environment.NPM_PACKAGE_NAME,
process.env.PRODUCTION != null && (process.env.PRODUCTION === "" || booleanize(process.env.PRODUCTION)) ? "production" : "development"
(process.env.PRODUCTION != null && (process.env.PRODUCTION === "" || booleanize(process.env.PRODUCTION))) || process.env.NODE_ENV === "production" ? "production" : "development"
);

export const constant: IConstant = {
Expand Down

0 comments on commit 54e2ca0

Please sign in to comment.