X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2FUIServerFactory.ts;h=2a125af07971fe9b724a06f45cf8c04b5e03c040;hb=aef5c03ddd1489b52df3801284d704342d60a41c;hp=392d1ee010f6ab1447cea880fdd311f8d19c21f7;hpb=eb3abc4fe41400debcf894e53f91937498e77571;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 392d1ee0..2a125af0 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -4,8 +4,8 @@ import type { UIServerConfiguration } from '../../types/ConfigurationData'; import { ApplicationProtocol } from '../../types/UIProtocol'; import Configuration from '../../utils/Configuration'; import type { AbstractUIServer } from './AbstractUIServer'; -import { UIServiceUtils } from './ui-services/UIServiceUtils'; import UIHttpServer from './UIHttpServer'; +import { UIServerUtils } from './UIServerUtils'; import UIWebSocketServer from './UIWebSocketServer'; export default class UIServerFactory { @@ -14,17 +14,16 @@ export default class UIServerFactory { } public static getUIServerImplementation( - applicationProtocol: ApplicationProtocol, uiServerConfiguration?: UIServerConfiguration ): AbstractUIServer | null { - if (UIServiceUtils.isLoopback(uiServerConfiguration.options?.host) === false) { + if (UIServerUtils.isLoopback(uiServerConfiguration.options?.host) === false) { console.warn( - chalk.magenta( + chalk.yellow( 'Loopback address not detected in UI server configuration. This is not recommended.' ) ); } - switch (applicationProtocol) { + switch (uiServerConfiguration?.type ?? Configuration.getUIServer().type) { case ApplicationProtocol.WS: return new UIWebSocketServer(uiServerConfiguration ?? Configuration.getUIServer()); case ApplicationProtocol.HTTP: