Skip to content

Commit

Permalink
Merge branch 'dev' into #322-AWS-SDK-V3-MIGRATE
Browse files Browse the repository at this point in the history
  • Loading branch information
14KGun committed Feb 6, 2024
2 parents 184f8be + 98d8046 commit bfab67e
Show file tree
Hide file tree
Showing 45 changed files with 4,674 additions and 2,228 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ CORS_WHITELIST=[CORS 정책에서 허용하는 도메인의 목록(e.g. ["http:/
GOOGLE_APPLICATION_CREDENTIALS=[GOOGLE_APPLICATION_CREDENTIALS JSON]
TEST_ACCOUNTS=[스팍스SSO로 로그인시 무조건 테스트로 로그인이 가능한 허용 아이디 목록]
SLACK_REPORT_WEBHOOK_URL=[Slack 웹훅 URL들이 담긴 JSON]

# optional environment variables for taxiSampleGenerator
SAMPLE_NUM_OF_ROOMS=[방의 개수]
SAMPLE_NUM_OF_CHATS=[각 방의 채팅 개수]
SAMPLE_MAXIMUM_INTERVAL_BETWEEN_CHATS=[채팅 간 최대 시간 간격(단위: 초, 실수도 가능)]
SAMPLE_OCCURENCE_OF_JOIN=[새로운 채팅이 입장 메세지일 확률(0 ~ 1 사이의 값)]
SAMPLE_OCCURENCE_OF_ABORT=[새로운 채팅이 퇴장 메세지일 확률(0 ~ 1 사이의 값)]
14 changes: 0 additions & 14 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- id: submodule-local
name: Save local version of submodule
run: echo "ver=`cd sampleGenerator && git log --pretty="%h" -1 && cd ..`" >> $GITHUB_OUTPUT
- id: submodule-origin
name: Save origin version of submodule
run: echo "ver=`cd sampleGenerator && git log origin --pretty="%h" -1 && cd ..`" >> $GITHUB_OUTPUT
- name: Check submodule version
if: ${{ steps.submodule-local.outputs.ver != steps.submodule-origin.outputs.ver }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Please update submodule to the latest version by using \"git submodule update --remote\"')
- name: Install sampleGenerator dependencies from package-lock.json
run: cd sampleGenerator && pnpm i --force --frozen-lockfile && cd ..
- name: Install taxi-back dependencies from package-lock.json
run: pnpm i --force --frozen-lockfile
- name: Run unit tests
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ See [contributors](https://github.com/sparcs-kaist/taxi-front/graphs/contributor
- app : https://github.com/sparcs-kaist/taxi-app
- docker : https://github.com/sparcs-kaist/taxi-docker
- figma : https://www.figma.com/file/li34hP1oStJAzLNjcG5KjN/SPARCS-Taxi?node-id=0%3A1
- taxiSampleGenerator : https://github.com/sparcs-kaist/taxiSampleGenerator
11 changes: 8 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// 모듈 require
const express = require("express");
const http = require("http");
const { port: httpPort, eventConfig } = require("./loadenv");
const {
nodeEnv,
port: httpPort,
eventConfig,
mongo: mongoUrl,
} = require("./loadenv");
const logger = require("./src/modules/logger");
const { connectDatabase } = require("./src/modules/stores/mongo");
const { startSocketServer } = require("./src/modules/socket");
Expand All @@ -13,14 +18,14 @@ require("./src/modules/fcm").initializeApp();
const app = express();

// 데이터베이스 연결
connectDatabase();
connectDatabase(mongoUrl);

// [Middleware] request body 파싱
app.use(express.urlencoded({ extended: false }));
app.use(express.json());

// reverse proxy가 설정한 헤더를 신뢰합니다.
app.set("trust proxy", true);
if (nodeEnv === "production") app.set("trust proxy", 2);

// [Middleware] CORS 설정
app.use(require("./src/middlewares/cors"));
Expand Down
7 changes: 5 additions & 2 deletions loadenv.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// 환경 변수에 따라 .env.production 또는 .env.development 파일을 읽어옴
require("dotenv").config({ path: `./.env.${process.env.NODE_ENV}` });
module.exports = {
nodeEnv: process.env.NODE_ENV,
nodeEnv: process.env.NODE_ENV, // required
mongo: process.env.DB_PATH, // required
session: process.env.SESSION_KEY || "TAXI_SESSION_KEY", // optional
session: {
secret: process.env.SESSION_KEY || "TAXI_SESSION_KEY", // optional
expiry: 14 * 24 * 3600 * 1000, // 14일, ms 단위입니다.
},
redis: process.env.REDIS_PATH, // optional
sparcssso: {
id: process.env.SPARCSSSO_CLIENT_ID || "", // optional
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"test": "npm run sample && cross-env TZ='Asia/Seoul' npm run mocha",
"mocha": "cross-env TZ='Asia/Seoul' NODE_ENV=test mocha --recursive --reporter spec --exit",
"serve": "cross-env TZ='Asia/Seoul' NODE_ENV=production node app.js",
"runscript": "cross-env TZ='Asia/Seoul' NODE_ENV=production node",
"lint": "npx eslint --fix .",
"sample": "cd sampleGenerator && npm start && cd .."
"sample": "cd src/sampleGenerator && npm start && cd .."
},
"engines": {
"node": ">=18.0.0",
Expand Down Expand Up @@ -61,6 +62,7 @@
"eslint": "^8.22.0",
"eslint-plugin-mocha": "^10.1.0",
"mocha": "^10.2.0",
"mongodb": "^4.1.0",
"nodemon": "^3.0.1",
"supertest": "^6.2.4"
}
Expand Down
Loading

0 comments on commit bfab67e

Please sign in to comment.