From b645f5fe09bfbd616950f7e5a01e6cd4218f5e55 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 19 Nov 2015 22:13:20 +0000 Subject: [PATCH] separate core code from data and apps --- boot/master.js | 8 ++++---- certs/live/.gitkeep | 0 lib/spawn-caddy.js | 1 + lib/worker.js | 10 +++++----- packages/apis/.gitkeep | 0 packages/apps/.gitkeep | 0 .../apps/com.daplie.cloud.lockscreen/index.html | 17 ----------------- sites-available/.gitkeep | 0 sites-enabled/.gitkeep | 0 var/.gitkeep | 0 10 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 certs/live/.gitkeep delete mode 100644 packages/apis/.gitkeep delete mode 100644 packages/apps/.gitkeep delete mode 100644 packages/apps/com.daplie.cloud.lockscreen/index.html delete mode 100644 sites-available/.gitkeep delete mode 100644 sites-enabled/.gitkeep delete mode 100644 var/.gitkeep diff --git a/boot/master.js b/boot/master.js index 2c40ae0..1311252 100644 --- a/boot/master.js +++ b/boot/master.js @@ -23,8 +23,8 @@ var conf = { // TODO externalInsecurePort? , locked: false // TODO XXX , ipcKey: null -, caddyfilepath: path.join(__dirname, '..', 'Caddyfile') -, sitespath: path.join(__dirname, '..', 'sites-enabled') +, caddyfilepath: path.join(__dirname, '..', '..', 'Caddyfile') +, sitespath: path.join(__dirname, '..', '..', 'sites-enabled') }; var state = {}; var caddy; @@ -42,7 +42,7 @@ function fork() { cluster.on('online', function (worker) { var path = require('path'); // TODO XXX Should these be configurable? If so, where? - var certPaths = [path.join(__dirname, 'certs', 'live')]; + var certPaths = [path.join(__dirname, '..', 'certs', 'live')]; var info; console.info('[MASTER] Worker ' + worker.process.pid + ' is online'); @@ -79,7 +79,7 @@ cluster.on('online', function (worker) { info.conf.memstoreSock = conf.memstoreSock; info.conf.sqlite3Sock = conf.sqlite3Sock; // TODO get this from db config instead - var config = require('../config'); + var config = require('../../config'); info.conf.primaryNameserver = config.primaryNameserver; info.conf.nameservers = config.nameservers; // TODO get this from db config instead diff --git a/certs/live/.gitkeep b/certs/live/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/lib/spawn-caddy.js b/lib/spawn-caddy.js index a983a2f..b382001 100644 --- a/lib/spawn-caddy.js +++ b/lib/spawn-caddy.js @@ -6,6 +6,7 @@ function tplCaddyfile(conf) { conf.domains.forEach(function (hostname) { var content = ""; + // TODO prefix content+= "https://" + hostname + " {\n" + " gzip\n" + " tls " diff --git a/lib/worker.js b/lib/worker.js index 587f224..1205b18 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -16,7 +16,7 @@ module.exports.create = function (webserver, info, state) { var sqlstores = {}; var models = {}; var systemFactory = require('sqlite3-cluster/client').createClientFactory({ - dirname: path.join(__dirname, '..', 'var') // TODO info.conf + dirname: path.join(__dirname, '..', '..', 'var') // TODO info.conf , prefix: 'com.daplie.' //, dbname: 'config' , suffix: '' @@ -28,7 +28,7 @@ module.exports.create = function (webserver, info, state) { algorithm: 'aes' , bits: 128 , mode: 'cbc' - , dirname: path.join(__dirname, '..', 'var') // TODO info.conf + , dirname: path.join(__dirname, '..', '..', 'var') // TODO info.conf , prefix: 'com.daplie.' //, dbname: 'cluster' , suffix: '' @@ -154,9 +154,9 @@ module.exports.create = function (webserver, info, state) { // rm -rf /tmp/walnut/; tar xvf -C /tmp/walnut/; mv /srv/walnut /srv/walnut.{{version}}; mv /tmp/walnut /srv/ // this means that any packages must be outside, perhaps /srv/walnut/{boot,core,packages} var apiConf = { - apppath: '../packages/apps/' - , apipath: '../packages/apis/' - , servicespath: path.join(__dirname, '..', 'packages', 'services') + apppath: path.join(__dirname, '..', '..', 'packages', 'apps') + path.sep + , apipath: path.join(__dirname, '..', '..', 'packages', 'apis') + path.sep + , servicespath: path.join(__dirname, '..', '..', 'packages', 'services') , vhostsMap: vhostsMap , server: webserver , externalPort: info.conf.externalPort diff --git a/packages/apis/.gitkeep b/packages/apis/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/packages/apps/.gitkeep b/packages/apps/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/packages/apps/com.daplie.cloud.lockscreen/index.html b/packages/apps/com.daplie.cloud.lockscreen/index.html deleted file mode 100644 index 0f303b3..0000000 --- a/packages/apps/com.daplie.cloud.lockscreen/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - Device Locked - - -

Device Locked

-

This device is locked and can only be unlocked with the device's encryption key.

- -
- - - -
-