mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-28 14:08:21 +02:00
feat: allow different host through CLI flag (#1475)
* feat(core): use 0.0.0.0 for livereload address * test(core): update server tests * feat(cli): add host by command line flag * test: revert test changes * fix(core): update server to use custom host if supplied * refactor: nits
This commit is contained in:
parent
382b88bb49
commit
0568ad4992
6 changed files with 13 additions and 8 deletions
|
@ -23,12 +23,13 @@ function startLiveReloadServer() {
|
|||
function startServer() {
|
||||
const initialServerPort =
|
||||
parseInt(program.port, 10) || process.env.PORT || 3000;
|
||||
const host = program.host || 'localhost';
|
||||
const promise = portFinder
|
||||
.getPortPromise({port: initialServerPort})
|
||||
.then(port => {
|
||||
server(port);
|
||||
server(port, host);
|
||||
const {baseUrl} = require(`${CWD}/siteConfig.js`);
|
||||
const serverAddress = `http://localhost:${port}${baseUrl}`;
|
||||
const serverAddress = `http://${host}:${port}${baseUrl}`;
|
||||
console.log('Docusaurus server started on port %d', port);
|
||||
openBrowser(serverAddress);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue