separate core code from data and apps

This commit is contained in:
AJ ONeal 2015-11-19 22:13:20 +00:00
джерело 6d3d334370
коміт b645f5fe09
10 змінених файлів з 10 додано та 26 видалено

@ -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

@ -6,6 +6,7 @@ function tplCaddyfile(conf) {
conf.domains.forEach(function (hostname) {
var content = "";
// TODO prefix
content+= "https://" + hostname + " {\n"
+ " gzip\n"
+ " tls "

@ -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

@ -1,17 +0,0 @@
<html>
<head>
<title>Device Locked</title>
</head>
<body>
<h1>Device Locked</h1>
<p>This device is locked and can only be unlocked with the device's encryption key.</p>
<!-- TODO QR Code -->
<form method="POST" action="/api/unlock-device">
<label>Encryption Key</label>
<input type="text">
<button type="submit">Unlock Device</button>
</form>
<script src="./scripts/jquery.js">
<script src="./scripts/app.js">
</body>
</html>