mirror of https://github.com/embarklabs/embark.git
expose buildDir to webserver in same manner as its done for pipeline
This commit is contained in:
parent
1d9237820a
commit
1d38af1f58
|
@ -228,6 +228,7 @@ class Engine {
|
|||
}
|
||||
|
||||
webServerService(_options) {
|
||||
_options.buildDir = this.config.buildDir;
|
||||
this.registerModule('webserver', _options);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ class WebServer {
|
|||
this.embark = embark;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.buildDir = options.buildDir;
|
||||
this.webServerConfig = embark.config.webServerConfig;
|
||||
if (!this.webServerConfig.enabled) {
|
||||
return;
|
||||
|
@ -19,6 +20,7 @@ class WebServer {
|
|||
this.events.emit("status", __("Starting Server"));
|
||||
|
||||
this.server = new Server({host: this.host, port: this.port});
|
||||
buildDir: this.buildDir,
|
||||
this.testPort(() => {
|
||||
this.listenToCommands();
|
||||
this.registerConsoleCommands();
|
||||
|
|
|
@ -12,7 +12,7 @@ const embark_building_placeholder = require('../code_generator/code_templates/em
|
|||
|
||||
class Server {
|
||||
constructor(options) {
|
||||
this.dist = options.dist || 'dist/';
|
||||
this.buildDir = options.buildDir;
|
||||
this.port = options.port || 8000;
|
||||
this.hostname = dockerHostSwap(options.host) || defaultHost;
|
||||
this.isFirstStart = true;
|
||||
|
@ -26,7 +26,7 @@ class Server {
|
|||
":" + this.port).bold.underline.green;
|
||||
return callback(null, message);
|
||||
}
|
||||
let serve = serveStatic(this.dist, {'index': ['index.html', 'index.htm']});
|
||||
let serve = serveStatic(this.buildDir, {'index': ['index.html', 'index.htm']});
|
||||
|
||||
this.server = http.createServer(function onRequest(req, res) {
|
||||
serve(req, res, finalhandler(req, res));
|
||||
|
|
Loading…
Reference in New Issue