UNPKG

780 BJavaScriptView Raw
1'use strict';
2
3const gulp = require('gulp');
4const settings = require('./settings.json');
5const plugins = require('gulp-load-plugins')(settings.plugins);
6
7let server;
8
9gulp.task('serve', () => {
10 const st2host = process.env.ST2_HOST || '127.0.0.1';
11 const options = {
12 rejectUnauthorized: false,
13 };
14
15 server = gulp.src('.')
16 .pipe(plugins.webserver({
17 host: '0.0.0.0',
18 port: process.env.PORT || 3000,
19 https: true,
20 proxies: [{
21 source: '/api',
22 target: `https://${st2host}/api`,
23 options,
24 }, {
25 source: '/auth',
26 target: `https://${st2host}/auth`,
27 options,
28 }, {
29 source: '/stream',
30 target: `https://${st2host}/stream`,
31 options,
32 }],
33 }));
34
35 return server;
36});