1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Automatically use prebuild resources if available.

This commit is contained in:
Simo Kinnunen 2015-06-30 17:44:58 +09:00
parent 76bce1a19d
commit 94dc1689b8
2 changed files with 4 additions and 9 deletions

View file

@ -601,8 +601,6 @@ program
.option('--user-profile-url <url>'
, 'URL to external user profile page'
, String)
.option('-d, --disable-watch'
, 'disable watching resources')
.action(function(options) {
if (!options.secret) {
this.missingArgument('--secret')
@ -621,7 +619,6 @@ program
, authUrl: options.authUrl
, websocketUrl: options.websocketUrl
, userProfileUrl: options.userProfileUrl
, disableWatch: options.disableWatch
})
})
@ -862,8 +859,6 @@ program
, 'provider name (or os.hostname())'
, String
, os.hostname())
.option('-d, --disable-watch'
, 'disable watching resources')
.option('-t, --group-timeout <seconds>'
, 'group timeout'
, Number
@ -975,9 +970,6 @@ program
)
].concat((function() {
var extra = []
if (options.disableWatch) {
extra.push('--disable-watch')
}
if (options.userProfileUrl) {
extra.push('--user-profile-url', options.userProfileUrl)
}

View file

@ -1,5 +1,6 @@
var http = require('http')
var url = require('url')
var fs = require('fs')
var express = require('express')
var validator = require('express-validator')
@ -40,7 +41,8 @@ module.exports = function(options) {
app.set('case sensitive routing', true)
app.set('trust proxy', true)
if (options.disableWatch) {
if (fs.existsSync(pathutil.resource('build'))) {
log.info('Using pre-built resources')
app.use(compression())
app.use('/static/app/build/entry',
serveStatic(pathutil.resource('build/entry')))
@ -49,6 +51,7 @@ module.exports = function(options) {
}))
}
else {
log.info('Using webpack')
app.use('/static/app/build',
require('./middleware/webpack')(webpackServerConfig))
}