Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
node-version: [18.16.0]

steps:

- name: Checkout source code.
uses: actions/checkout@v2

Expand Down Expand Up @@ -59,6 +58,8 @@ jobs:
echo NODE_ENV=${{ secrets.NODE_ENV }} >> .env
echo PROMPT_REDIS_KEY=${{ secrets.PROMPT_REDIS_KEY }} >> .env
echo MAIN_SERVER=${{ secrets.MAIN_SERVER }} >> .env
echo SWAGGER_USER=${{ secrets.SWAGGER_USER }} >> .env
echo SWAGGER_PASSWORD=${{ secrets.SWAGGER_PASSWORD }} >> .env

- name: build server files
working-directory: ./
Expand All @@ -80,4 +81,4 @@ jobs:
run: aws s3 cp --region ap-northeast-2 ./${{ env.GITHUB_SHA }}.zip s3://insightout-prod-s3/deploy/

- name: deploy with AWS codeDeploy
run: aws deploy create-deployment --application-name insightout-prod --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name insight-out-prod-group --s3-location bucket=insightout-prod-s3,bundleType=zip,key=deploy/${{ env.GITHUB_SHA }}.zip
run: aws deploy create-deployment --application-name insightout-prod --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name insight-out-prod-group --s3-location bucket=insightout-prod-s3,bundleType=zip,key=deploy/${{ env.GITHUB_SHA }}.zip
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"cookie-parser": "^1.4.6",
"dayjs": "^1.11.7",
"dotenv-cli": "^7.2.1",
"express-basic-auth": "^1.2.1",
"firebase-admin": "^11.8.0",
"google-auth-library": "^8.8.0",
"hanspell": "^0.9.7",
Expand Down
8 changes: 8 additions & 0 deletions src/apps/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { EnvService } from '📚libs/modules/env/env.service';
import { AppModule } from './app.module';
import cookieParser from 'cookie-parser';
import { swaggerDescriptionMd } from '🔥apps/server/common/markdowns/swagger-description.markdown';
import basicAuth from 'express-basic-auth';

async function bootstrap() {
const app = await NestFactory.create(AppModule);
Expand All @@ -16,6 +17,13 @@ async function bootstrap() {
const envService = app.get(EnvService);
const PORT = +envService.get(EnvEnum.PORT) || 3000;

app.use(
basicAuth({
users: { [envService.get<string>(EnvEnum.SWAGGER_USER)]: envService.get<string>(EnvEnum.SWAGGER_PASSWORD) },
challenge: true,
}),
);

const config = new DocumentBuilder()
.setTitle('13기 4팀 서버')
.setDescription(swaggerDescriptionMd)
Expand Down
4 changes: 4 additions & 0 deletions src/libs/modules/env/env.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@ export enum EnvEnum {

// redis key
PROMPT_REDIS_KEY,

// swagger
SWAGGER_USER,
SWAGGER_PASSWORD,
}
24 changes: 19 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,13 @@ base64-js@^1.3.0, base64-js@^1.3.1:
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==

basic-auth@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a"
integrity sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==
dependencies:
safe-buffer "5.1.2"

bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz"
Expand Down Expand Up @@ -2988,6 +2995,13 @@ expect@^29.0.0, expect@^29.5.0:
jest-message-util "^29.5.0"
jest-util "^29.5.0"

express-basic-auth@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/express-basic-auth/-/express-basic-auth-1.2.1.tgz#d31241c03a915dd55db7e5285573049cfcc36381"
integrity sha512-L6YQ1wQ/mNjVLAmK3AG1RK6VkokA1BIY6wmiH304Xtt/cLTps40EusZsU1Uop+v9lTDPxdtzbFmdXfFO3KEnwA==
dependencies:
basic-auth "^2.0.1"

express@4.18.2:
version "4.18.2"
resolved "https://registry.npmjs.org/express/-/express-4.18.2.tgz"
Expand Down Expand Up @@ -5647,16 +5661,16 @@ rxjs@^7.2.0, rxjs@^7.5.5:
dependencies:
tslib "^2.1.0"

safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==

safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==

safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==

safe-stable-stringify@^2.3.1:
version "2.4.3"
resolved "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz"
Expand Down