Skip to content

Commit 330f4e4

Browse files
authored
Merge pull request #19 from modern-agile-team/feature/kjs/#16
[Feature/kjs/#16] Working to specify a swagger host via env
2 parents 5cd24d8 + a9d6073 commit 330f4e4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

server/app/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ dotenv.config({ path: '../../config/.server.env' });
99

1010
const app = express();
1111
const PORT = process.env.PORT || 8000;
12+
const HOST_ADDRESS = process.env.HOST_ADDRESS || 'localhost'
1213

1314
const swaggerSpec = YAML.load(path.join(__dirname, './swagger.yaml'));
1415
const portInjectedSwaggerSpec = JSON.stringify(swaggerSpec).replace(
1516
'{PORT}',
1617
PORT.toString()
17-
);
18+
).replace('{HOST_ADDRESS}', HOST_ADDRESS);
1819

1920
import visitor from './src/apis/visitor';
2021

server/app/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ info:
44
title: 'dev-portfolio API'
55
description: 'dev-portfolio API'
66
servers:
7-
- url: http://localhost:{PORT}/
7+
- url: http://{HOST_ADDRESS}:{PORT}/
88
paths:
99
/apis/visitor/count:
1010
patch:

0 commit comments

Comments
 (0)