Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async findServerUrl (args, defaults) {
const useHttps = coalesce(args.https, defaults.https);
const protocol = useHttps ? 'https' : 'http';
const host = coalesce(args.host, process.env.HOST, defaults.host);
const port = await findPort(coalesce(args.port, process.env.PORT, defaults.port));
const urls = prepareURLs(protocol, host, port);
return {
protocol,
host,
port,
path,
networkUrl: urls.lanUrlForTerminal,
localUrl: format({ protocol, hostname: host, port, pathname: '/' }),
localUrlForTerminal: urls.localUrlForTerminal,
localUrlForBrowser: urls.localUrlForBrowser,
};
},
};