2017-04-27 02:16:47 +00:00
|
|
|
module.exports.create = function (deps, conf) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
//var defaultServername = 'localhost.daplie.me';
|
2017-04-27 22:27:27 +00:00
|
|
|
//var defaultWebRoot = '.';
|
2017-04-27 02:16:47 +00:00
|
|
|
var assetsPath = path.join(__dirname, '..', '..', 'packages', 'assets');
|
2017-04-27 22:50:03 +00:00
|
|
|
var opts = {};
|
2017-04-27 02:16:47 +00:00
|
|
|
|
2017-04-27 22:50:03 +00:00
|
|
|
opts.global = opts.global || {};
|
|
|
|
opts.sites = opts.sites || [];
|
2017-04-27 02:16:47 +00:00
|
|
|
opts.sites._map = {};
|
|
|
|
|
|
|
|
// argv.sites
|
|
|
|
|
|
|
|
opts.groups = [];
|
|
|
|
|
2017-04-28 01:34:13 +00:00
|
|
|
// 'packages', 'assets', 'com.daplie.goldilocks'
|
2017-04-27 02:16:47 +00:00
|
|
|
opts.global = {
|
|
|
|
modules: [ // TODO uh-oh we've got a mixed bag of modules (various types), a true map
|
|
|
|
{ $id: 'greenlock', email: opts.email, tos: opts.tos }
|
|
|
|
, { $id: 'rvpn', email: opts.email, tos: opts.tos }
|
|
|
|
//, { $id: 'content', content: content }
|
|
|
|
, { $id: 'livereload', on: opts.livereload }
|
|
|
|
, { $id: 'app', path: opts.expressApp }
|
|
|
|
]
|
|
|
|
, paths: [
|
|
|
|
{ $id: '/assets/', modules: [ { $id: 'serve', paths: [ assetsPath ] } ] }
|
|
|
|
// TODO figure this b out
|
|
|
|
, { $id: '/.well-known/', modules: [
|
|
|
|
{ $id: 'serve', paths: [ path.join(assetsPath, 'well-known') ] }
|
|
|
|
] }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
opts.defaults = {
|
|
|
|
modules: []
|
|
|
|
, paths: [
|
2017-04-27 22:27:27 +00:00
|
|
|
/*
|
2017-04-27 02:16:47 +00:00
|
|
|
{ $id: '/', modules: [
|
|
|
|
{ $id: 'serve', paths: [ defaultWebRoot ] }
|
|
|
|
, { $id: 'indexes', paths: [ defaultWebRoot ] }
|
|
|
|
] }
|
2017-04-27 22:27:27 +00:00
|
|
|
*/
|
2017-04-27 02:16:47 +00:00
|
|
|
]
|
|
|
|
};
|
|
|
|
opts.sites.push({
|
|
|
|
// greenlock: {}
|
|
|
|
$id: 'localhost.alpha.daplie.me'
|
|
|
|
, paths: [
|
2017-04-27 22:27:27 +00:00
|
|
|
{ $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
|
|
|
|
, { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
|
2017-04-27 02:16:47 +00:00
|
|
|
]
|
|
|
|
});
|
|
|
|
opts.sites.push({
|
|
|
|
$id: 'localhost.daplie.invalid'
|
|
|
|
, paths: [
|
2017-04-27 22:27:27 +00:00
|
|
|
{ $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
|
2017-04-27 02:16:47 +00:00
|
|
|
, { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
2017-05-18 01:16:45 +00:00
|
|
|
var app = require('../app.js')(deps, conf, opts);
|
|
|
|
return require('http').createServer(app);
|
2017-04-27 02:16:47 +00:00
|
|
|
};
|