diff --git a/.gitignore b/.gitignore index 840b328..51bc292 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules/ .env +*.env .discord-token.json +build/ diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..77a25fd --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,12 @@ +module.exports = { + apps: [ + { + name: 'IotDis', + script: './build/index.js', + env: { + NODE_ENV: 'production', + }, + watch: ['./build', './ecosystem.config.js', './.env'], + }, + ], +}; diff --git a/package.json b/package.json index 8d853d4..1bfd0a6 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "tsx src/index.ts", - "build": "tsc src/index.ts --outDir dist --esModuleInterop", - "start": "node dist/index.js" + "build": "tsc src/index.ts --outDir build --esModuleInterop", + "start": "node build/index.js" }, "keywords": [], "author": "", diff --git a/src/config.ts b/src/config.ts index ddf47fe..aad8a3e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,8 @@ import { config as dotenvConfig } from 'dotenv'; -dotenvConfig(); +dotenvConfig({ + path: process.env.NODE_ENV === 'production' ? './.env' : './.dev.env', +}); export const CONFIG: { CLIENT_ID: string;