Skip to content

Commit

Permalink
add heroku support
Browse files Browse the repository at this point in the history
  • Loading branch information
wxxxcxx committed Jul 1, 2022
1 parent c4403e2 commit 52fff51
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ WORKDIR /app

COPY ./ ./
RUN npm install
RUN npm run build

EXPOSE 3000
ENV TOKEN= LOG_LEVEL=info PORT=3000

ENV TOKEN= LOG_LEVEL=info
EXPOSE $PORT

ENTRYPOINT [ "npm", "run", "start" ]
CMD [ "node", "./dist/app.js" ]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

## 更新日志

**2022-06-30: Vercel 的 IP 好像被微软拉黑了**

**2022-06-16:Edge 浏览器提供的接口现在已经不能设置讲话风格了,若发现不能正常使用,请参考 [#12](https://github.com/meetcw/ms-ra-forwarder/issues/12#issuecomment-1157271193) 获取更新。**

## 使用
Expand Down
16 changes: 16 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ms-ra-forwarder",
"description": "Microsoft Read Aloud Forwarder",
"repository": "https://github.com/meetcw/ms-ra-forwarder",
"env": {
"TOKEN": {
"description": "保护您的服务不被其他人访问",
"required": true
},
"LOG_LEVEL": {
"description": "日志级别,可选 debug、info、notice、warning、error",
"required": false
}
},
"stack": "container"
}
3 changes: 2 additions & 1 deletion app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import * as logger from 'log'

require('log-node')()
const app = express()
const port = 3000

const port = process.env.PORT ? parseInt(process.env.PORT) : 3000
logger.notice(port)
app.use(bodyParser.text({ type: '*/*' }))
app.use(express.static('public'))

Expand Down
3 changes: 3 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
worker: Dockerfile
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "",
"scripts": {
"start": "ts-node ./app.ts"
"start": "ts-node ./app.ts",
"build": "tsc"
},
"dependencies": {
"body-parser": "^1.20.0",
Expand Down

0 comments on commit 52fff51

Please sign in to comment.