Skip to content

Commit a7dc684

Browse files
author
Artem
committed
add listen interface for be server
1 parent cf97e38 commit a7dc684

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

redisinsight/api/config/default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
},
4040
server: {
4141
env: 'development',
42+
listenInterface: process.env.RI_LISTEN_INTERFACE === '*' ? '' : (process.env.RI_LISTEN_INTERFACE || '127.0.0.1'),
4243
port: 5000,
4344
docPrefix: 'api/docs',
4445
globalPrefix: 'api',

redisinsight/api/src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import { AppModule } from './app.module';
1212
import SWAGGER_CONFIG from '../config/swagger';
1313
import LOGGER_CONFIG from '../config/logger';
1414

15+
const serverConfig = get('server');
16+
1517
export default async function bootstrap(): Promise<Function> {
1618
await migrateHomeFolder();
1719

18-
const serverConfig = get('server');
1920
const port = process.env.API_PORT || serverConfig.port;
2021
const logger = WinstonModule.createLogger(LOGGER_CONFIG);
2122

@@ -47,7 +48,7 @@ export default async function bootstrap(): Promise<Function> {
4748

4849
const logFileProvider = app.get(LogFileProvider);
4950

50-
await app.listen(port);
51+
await app.listen(port, serverConfig.listenInterface);
5152
logger.log({
5253
message: `Server is running on http(s)://localhost:${port}`,
5354
context: 'bootstrap',

0 commit comments

Comments
 (0)