From d969a7d4d402e3f874545b20d4cdb9a6ef35a065 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 9 Jun 2017 01:23:43 +0000 Subject: [PATCH 1/6] return correct cached var --- lib/apis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apis.js b/lib/apis.js index 2b423fc..d0ae567 100644 --- a/lib/apis.js +++ b/lib/apis.js @@ -425,7 +425,7 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) { , get: function () { var Mailchimp = require('mailchimp-api-v3'); _mailchimp = _mailchimp || new Mailchimp(siteConfig['mailchimp.com'].apiKey); - return _stripe_test; + return _mailchimp; } }); From 4da591c9268ce0b20d4b04c9db7b7b1c4cd50fa6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 9 Jun 2017 22:13:29 +0000 Subject: [PATCH 2/6] add hostname used to debug message --- lib/worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/worker.js b/lib/worker.js index a3520f2..97c0a7d 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -212,7 +212,7 @@ module.exports.create = function (webserver, xconfx, state) { if (!/^api\.[a-z0-9\-]+/.test(hostname)) { res.send({ error: - { message: "API access is restricted to proper 'api'-prefixed lowercase subdomains." + { message: "['" + hostname + "'] API access is restricted to proper 'api'-prefixed lowercase subdomains." + " The HTTP 'Host' header must exist and must begin with 'api.' as in 'api.example.com'." + " For development you may test with api.localhost.daplie.me (or any domain by modifying your /etc/hosts)" , code: 'E_NOT_API' From b0ff8bca573801751df477ca19794820f0ebe358 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 9 Jun 2017 22:15:38 +0000 Subject: [PATCH 3/6] more url info to make debugging easier --- lib/worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/worker.js b/lib/worker.js index 97c0a7d..6ddd28b 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -212,7 +212,7 @@ module.exports.create = function (webserver, xconfx, state) { if (!/^api\.[a-z0-9\-]+/.test(hostname)) { res.send({ error: - { message: "['" + hostname + "'] API access is restricted to proper 'api'-prefixed lowercase subdomains." + { message: "['" + hostname + req.url + "'] API access is restricted to proper 'api'-prefixed lowercase subdomains." + " The HTTP 'Host' header must exist and must begin with 'api.' as in 'api.example.com'." + " For development you may test with api.localhost.daplie.me (or any domain by modifying your /etc/hosts)" , code: 'E_NOT_API' From b46e489e52170cf3a7020593fc12ebf5227a3a4b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 12 Jun 2017 16:06:18 -0600 Subject: [PATCH 4/6] remove cruft --- install.sh | 22 +++++++++++++++++++--- lib/bootstrap.js | 13 ++----------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index a0a9f01..554940e 100755 --- a/install.sh +++ b/install.sh @@ -218,12 +218,28 @@ install_my_app() { #git clone git@git.daplie.com:Daplie/walnut.js.git #git clone https://git.daplie.com/Daplie/walnut.js.git /srv/walnut/core - sudo mkdir -p /srv/walnut/{core,lib,etc,config,node_modules} + sudo mkdir -p /srv/walnut/{core,lib,var,etc,node_modules} rm -rf /srv/walnut/core/node_modules ln -sf ../node_modules /srv/walnut/core/node_modules + sudo mkdir -p /srv/walnut/var/sites sudo mkdir -p /srv/walnut/etc/org.oauth3.consumer sudo mkdir -p /srv/walnut/etc/org.oauth3.provider - sudo mkdir -p /srv/walnut/packages/{client-api-grants,rest,api,pages,services,sites} + sudo mkdir -p /srv/walnut/etc/client-api-grants + sudo mkdir -p /srv/walnut/packages/{rest,api,pages,services} + + # backwards compat + if [ -d /srv/walnut/packages/client-api-grants ]; then + mv /srv/walnut/packages/client-api-grants/* /srv/walnut/etc/client-api-grants/ + rm -r /srv/walnut/packages/client-api-grants + #rmdir /srv/walnut/packages/client-api-grants + fi + if [ -d /srv/walnut/packages/sites ]; then + mv /srv/walnut/packages/sites/* /srv/walnut/var/sites + rm -r /srv/walnut/packages/sites + #rmdir /srv/walnut/packages/sites + fi + ln -s /srv/walnut/etc/client-api-grants /srv/walnut/packages/client-api-grants + ln -s /srv/walnut/var/sites /srv/walnut/packages/client-api-grants pushd /srv/walnut/core npm install @@ -240,4 +256,4 @@ install_service sudo chown -R www-data:www-data /srv/walnut || true sudo chown -R _www:_www /srv/walnut || true -sudo chmod -R ug+Xrw /srv/walnut +sudo chmod -R ug+rwX /srv/walnut diff --git a/lib/bootstrap.js b/lib/bootstrap.js index 621e886..902c158 100644 --- a/lib/bootstrap.js +++ b/lib/bootstrap.js @@ -21,17 +21,8 @@ module.exports.create = function (app, xconfx, models) { } xconfx.primaryDomain = xconfx.primaryDomain || conf.primaryDomain; - - var configpath = path.join(__dirname, '..', '..', 'config', conf.primaryDomain + '.json'); - - return fs.readFileAsync(configpath, 'utf8').then(function (text) { - return JSON.parse(text); - }, function (/*err*/) { - console.log('DEBUG not exists leconf', configpath); - return false; - }).then(function (data) { - return true; - }); + // backwards compat for something or other + return true; }); } From 6f1895a2d69ef6d6fb99790d320ced4e2d62dba5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 13 Jun 2017 10:52:26 -0600 Subject: [PATCH 5/6] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c9419ec..84ebda6 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,15 @@ Currently being tested with Ubuntu, Raspbian, and Debian on Digital Ocean, Raspb │ ├── boot │ ├── holepunch │ └── lib +├── etc +│ └── client-api-grants ├── node_modules ├── packages │ ├── apis │ ├── pages │ └── services └── var + └── sites ``` * `core` contains all walnut code From 9dacd8e230f3ea616237639630016dbaedde7d35 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 13 Jun 2017 10:56:44 -0600 Subject: [PATCH 6/6] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 84ebda6..7b6ee42 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,11 @@ In Progress * [GunDB](https://gundb.io) Support * OpenID support +API +--- + +API docs are here https://git.daplie.com/Daplie/com.example.hello + Structure =====