X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2FUIServerFactory.ts;h=b0020b2e872e11dc6a59b0a5491f265203453a45;hb=db2336d96424096d5570606680824af180e33c3a;hp=1ad64014219ace91a0bdcf3c4afe24e4fb00f8ba;hpb=b153c0fd46bdc1dc8006e4dac4d4dfa739ff7707;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index 1ad64014..b0020b2e 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -1,7 +1,10 @@ -import { AbstractUIServer } from './AbstractUIServer'; +import chalk from 'chalk'; + +import { ServerOptions } from '../../types/ConfigurationData'; import { ApplicationProtocol } from '../../types/UIProtocol'; import Configuration from '../../utils/Configuration'; -import { ServerOptions } from '../../types/ConfigurationData'; +import { AbstractUIServer } from './AbstractUIServer'; +import { UIServiceUtils } from './ui-services/UIServiceUtils'; import UIWebSocketServer from './UIWebSocketServer'; export default class UIServerFactory { @@ -13,6 +16,13 @@ export default class UIServerFactory { applicationProtocol: ApplicationProtocol, options?: ServerOptions ): AbstractUIServer | null { + if (!UIServiceUtils.isLoopback(options?.host)) { + console.warn( + chalk.magenta( + 'Loopback address not detected in UI server configuration. This is not recommended.' + ) + ); + } switch (applicationProtocol) { case ApplicationProtocol.WS: return new UIWebSocketServer(options ?? Configuration.getUIServer().options);