Skip to content

Commit 1cf9a97

Browse files
committed
fix: set production env when npm start
1 parent d83792d commit 1cf9a97

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ for example `docker run --name rssbot -d -e RSSBOT_TOKEN=123456:abcdef123456-U f
6464
1. clone this repository `git clone https://github.com/fengkx/NodeRSSBot.git`
6565
1. Set the `RSSBOT_TOKEN` environment variable or set it in config/index.js
6666
1. Install dependencies run `npm i` in the root directory of the repository
67-
1. Run `pm2 start index.js`
67+
1. Run `pm2 start npm --name node_rssbot -- start` (recommend) or `npm start`
68+
69+
**Note that NODE_PRODUTION environment should be set in prodution mode**
6870

6971
# Setting
7072

@@ -170,7 +172,9 @@ viewall 只能在私聊中使用
170172
1. 克隆仓库 `git clone https://github.com/fengkx/NodeRSSBot.git`
171173
1. 设置 `RSSBOT_TOKEN` 环境变量,或者直接在 `config/index.js` 中修改
172174
1. 安装依赖 在仓库根目录运行`npm i`
173-
1. 推荐用 `pm2` 守护进程 `pm2 start index.js` 如果没有安装`pm2` 就先安装 `npm i -g pm2`
175+
1. 推荐用 `pm2` 守护进程 `pm2 start npm --name node_rssbot -- start` 如果没有安装`pm2` 就先安装 `npm i -g pm2` 或者直接 `npm start`
176+
177+
**注意生产环境下要设置 NODE_PRODUTION 环境变量**
174178

175179
# TODO
176180

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Another Telegram RSSBot in Node.js",
55
"main": "index.js",
66
"scripts": {
7-
"start": "node index",
7+
"start": "node -e 'process.env.NODE_PRODUTION = process.env.NODE_PRODUTION || \"production\"; require(\"./index.js\");'",
88
"dev": "proxychains -q node $NODE_DEBUG_OPTION index",
99
"test": "echo \"Error: no test specified\" && exit 1",
1010
"format": "eslint \"**/*.js\" --fix && prettier \"**/*.{js,json,md}\" --write",

0 commit comments

Comments
 (0)