24 lines
704 B
JavaScript
24 lines
704 B
JavaScript
const { ServiceRegister } = require("@fennec/configuration");
|
|
const { findFreePorts } = require("find-free-ports");
|
|
|
|
module.exports = async function () {
|
|
return {
|
|
devServer: {
|
|
open: false,
|
|
port: await findFreePorts().then((ports) => ports[0]),
|
|
onListening(devServer) {
|
|
if (!devServer) {
|
|
throw new Error("webpack-dev-server is not defined");
|
|
}
|
|
|
|
const port = devServer.listeningApp.address().port;
|
|
const register = new ServiceRegister({
|
|
etcd: { hosts: ["http://rpi:2379"] },
|
|
});
|
|
register.register("admin.blog", `http://localhost:${port}/`);
|
|
console.log("Listening on port:", port);
|
|
},
|
|
},
|
|
};
|
|
};
|