forked from coolaj86/goldilocks.js
65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
module.exports.create = function (deps, conf) {
|
|
'use strict';
|
|
|
|
var path = require('path');
|
|
//var defaultServername = 'localhost.daplie.me';
|
|
//var defaultWebRoot = '.';
|
|
var assetsPath = path.join(__dirname, '..', '..', 'packages', 'assets');
|
|
var opts = {};
|
|
|
|
opts.global = opts.global || {};
|
|
opts.sites = opts.sites || [];
|
|
opts.sites._map = {};
|
|
|
|
// argv.sites
|
|
|
|
opts.groups = [];
|
|
|
|
// 'packages', 'assets', 'com.daplie.goldilocks'
|
|
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: [
|
|
/*
|
|
{ $id: '/', modules: [
|
|
{ $id: 'serve', paths: [ defaultWebRoot ] }
|
|
, { $id: 'indexes', paths: [ defaultWebRoot ] }
|
|
] }
|
|
*/
|
|
]
|
|
};
|
|
opts.sites.push({
|
|
// greenlock: {}
|
|
$id: 'localhost.alpha.daplie.me'
|
|
, paths: [
|
|
{ $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
|
|
, { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
|
|
]
|
|
});
|
|
opts.sites.push({
|
|
$id: 'localhost.daplie.invalid'
|
|
, paths: [
|
|
{ $id: '/', modules: [ { $id: 'serve', paths: [ path.resolve(__dirname, '..', '..', 'admin', 'public') ] } ] }
|
|
, { $id: '/api/', modules: [ { $id: 'app', path: path.join(__dirname, 'admin') } ] }
|
|
]
|
|
});
|
|
|
|
/* device, addresses, cwd, http */
|
|
return require('../app.js')(deps, conf, opts);
|
|
};
|