From 92be7cc355189f8ba6208b1ee30b2209d25c5522 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Fri, 1 Sep 2023 18:02:06 +0800 Subject: [PATCH] [del] env --- .env | 9 --------- .vscode/launch.json | 3 ++- package.json | 5 +++-- src/index.ts | 5 ++++- yarn.lock | 5 +++++ 5 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 136a84b..0000000 --- a/.env +++ /dev/null @@ -1,9 +0,0 @@ -URLPATH = /linewebhook -PORT = 3003 - -# DB---------------------------------------------- -DB_HOST = 192.168.0.15 -DB_PORT = 3307 -DB_USER = jianmiau -DB_PASSWORD = VQ*ZetC7xcc9%dTW -DB_DATABASE = badminton \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 21794a8..aacadda 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,8 @@ "address": "127.0.0.1:9229/87f42d5b-97bf-4d25-a4d7-37306985459a", "port": 9229, "localRoot": "${workspaceFolder}", - "remoteRoot": "D:/Project/Test/Test_Web/GuessWhoIAmS", + // "remoteRoot": "D:/Project/Test/Test_Web/GuessWhoIAmS", + "remoteRoot": "E:/Project/Test/Test_NodeJS/GuessWhoIAmS", // "remoteRoot": "/volume1/homes/JianMiau/www/line-bot-ts", "skipFiles": [ "/**" diff --git a/package.json b/package.json index 20448e9..f149207 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "npm run dev", "dev": "tsrpc-cli dev", - "debug": "nodemon --exec \"node --require ts-node/register --inspect=127.0.0.1:9229 src/index.ts\"", + "debug": "set NODE_ENV=dev && nodemon --exec \"node --require ts-node/register --inspect=127.0.0.1:9229 src/index.ts\"", "build": "tsrpc-cli build", "doc": "tsrpc-cli doc", "test": "mocha test/**/*.test.ts", @@ -25,6 +25,7 @@ }, "dependencies": { "dayjs": "^1.11.9", + "dotenv": "^16.3.1", "tsrpc": "^3.4.12" } -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index 0128aec..676fae9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import dayjs from "dayjs"; import "dayjs/locale/zh-tw"; +import dotenv from "dotenv"; import * as path from "path"; import { WsServer } from "tsrpc"; import { BaseEnumerator } from "./Engine/CatanEngine/CoroutineV2/Core/BaseEnumerator"; @@ -10,10 +11,12 @@ import { serviceProto } from './shared/protocols/serviceProto'; BaseEnumerator.Init(); dayjs.locale("zh-tw") +dotenv.config(); // Create the Server +const port: number = +process.env.PORT || 3000 export const server = new WsServer(serviceProto, { - port: 3003, + port: port, // Remove this to use binary mode (remove from the client too) json: true }); diff --git a/yarn.lock b/yarn.lock index 4d0ea7a..69634e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -327,6 +327,11 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + editorconfig@^0.15.0: version "0.15.3" resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5"