Merge branch 'master' of git.daplie.com:Daplie/walnut.js
This commit is contained in:
commit
b9551e7b8a
|
@ -56,6 +56,11 @@ In Progress
|
||||||
* [GunDB](https://gundb.io) Support
|
* [GunDB](https://gundb.io) Support
|
||||||
* OpenID support
|
* OpenID support
|
||||||
|
|
||||||
|
API
|
||||||
|
---
|
||||||
|
|
||||||
|
API docs are here https://git.daplie.com/Daplie/com.example.hello
|
||||||
|
|
||||||
Structure
|
Structure
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
@ -69,12 +74,15 @@ Currently being tested with Ubuntu, Raspbian, and Debian on Digital Ocean, Raspb
|
||||||
│ ├── boot
|
│ ├── boot
|
||||||
│ ├── holepunch
|
│ ├── holepunch
|
||||||
│ └── lib
|
│ └── lib
|
||||||
|
├── etc
|
||||||
|
│ └── client-api-grants
|
||||||
├── node_modules
|
├── node_modules
|
||||||
├── packages
|
├── packages
|
||||||
│ ├── apis
|
│ ├── apis
|
||||||
│ ├── pages
|
│ ├── pages
|
||||||
│ └── services
|
│ └── services
|
||||||
└── var
|
└── var
|
||||||
|
└── sites
|
||||||
```
|
```
|
||||||
|
|
||||||
* `core` contains all walnut code
|
* `core` contains all walnut code
|
||||||
|
|
22
install.sh
22
install.sh
|
@ -218,12 +218,28 @@ install_my_app()
|
||||||
{
|
{
|
||||||
#git clone git@git.daplie.com:Daplie/walnut.js.git
|
#git clone git@git.daplie.com:Daplie/walnut.js.git
|
||||||
#git clone https://git.daplie.com/Daplie/walnut.js.git /srv/walnut/core
|
#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
|
rm -rf /srv/walnut/core/node_modules
|
||||||
ln -sf ../node_modules /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.consumer
|
||||||
sudo mkdir -p /srv/walnut/etc/org.oauth3.provider
|
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
|
pushd /srv/walnut/core
|
||||||
npm install
|
npm install
|
||||||
|
@ -240,4 +256,4 @@ install_service
|
||||||
|
|
||||||
sudo chown -R www-data:www-data /srv/walnut || true
|
sudo chown -R www-data:www-data /srv/walnut || true
|
||||||
sudo chown -R _www:_www /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
|
||||||
|
|
|
@ -425,7 +425,7 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
, get: function () {
|
, get: function () {
|
||||||
var Mailchimp = require('mailchimp-api-v3');
|
var Mailchimp = require('mailchimp-api-v3');
|
||||||
_mailchimp = _mailchimp || new Mailchimp(siteConfig['mailchimp.com'].apiKey);
|
_mailchimp = _mailchimp || new Mailchimp(siteConfig['mailchimp.com'].apiKey);
|
||||||
return _stripe_test;
|
return _mailchimp;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,8 @@ module.exports.create = function (app, xconfx, models) {
|
||||||
}
|
}
|
||||||
|
|
||||||
xconfx.primaryDomain = xconfx.primaryDomain || conf.primaryDomain;
|
xconfx.primaryDomain = xconfx.primaryDomain || conf.primaryDomain;
|
||||||
|
// backwards compat for something or other
|
||||||
var configpath = path.join(__dirname, '..', '..', 'config', conf.primaryDomain + '.json');
|
return true;
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ module.exports.create = function (webserver, xconfx, state) {
|
||||||
|
|
||||||
if (!/^api\.[a-z0-9\-]+/.test(hostname)) {
|
if (!/^api\.[a-z0-9\-]+/.test(hostname)) {
|
||||||
res.send({ error:
|
res.send({ error:
|
||||||
{ message: "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'."
|
+ " 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)"
|
+ " For development you may test with api.localhost.daplie.me (or any domain by modifying your /etc/hosts)"
|
||||||
, code: 'E_NOT_API'
|
, code: 'E_NOT_API'
|
||||||
|
|
Loading…
Reference in New Issue