diff --git a/README.md b/README.md index a700c7a..a8f2539 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,40 @@ POST https://api./api/com.daplie.walnut.init { "domain": "" } ``` +The following domains are required to point to WALNUT server + +``` + +www. + +api. +assets. + +cloud. +api.cloud. +``` + +Example `/etc/goldilocks/goldilocks.yml`: +```yml +tls: + email: domains@example.com + servernames: + - example.com + - www.example.com + - api.example.com + - assets.example.com + - cloud.example.com + - api.cloud.example.com + +http: + trust_proxy: true + modules: + - name: proxy + domains: + - '*' + address: '127.0.0.1:3000' +``` + Resetting the Initialization ---------------------------- @@ -109,9 +143,75 @@ Static apps are stored in `packages/pages` ``` # App ID as files with a list of packages they should load -/srv/walnut/packages/pages/ # https://domain.tld/path -/srv/walnut/packages/pages/ # https://domain.tld and https://domain.tld/foo match +# note that '#' is used in place of '/' because files and folders may not contain '/' in their names +/srv/walnut/packages/sites/ # https://domain.tld/path +/srv/walnut/packages/sites/ # https://domain.tld and https://domain.tld/foo match -# packages are directories with reverse dns name # used for debugging -/srv/walnut/packages/pages/ # matches apps./ and /apps/ +# packages are directories with reverse dns name # For the sake of debugging these packages can be accessed directly, without a site by +/srv/walnut/packages/pages/ # matches apps./ and /apps/ +``` + +Accessing REST APIs +------------------- + +``` +# Apps are granted access to use a package by listing it in the grants file by the name of the app url (domain.tld) +/srv/walnut/packages/client-api-grants/ # matches api./api/ and contains a list of allowed REST APIs + # the REST apis themselves are submatched as api./api/ + +# packages are directories with reverse dns name, a package.json, and an index.js +/srv/walnut/packages/rest/ +``` + +Example tree with contents: + +Here `com.example.hello` is a package with a REST API and a static page +and `foobar.me` is a WALNUT-configured domain (smithfam.net, etc). + +``` +/srv/walnut/packages/ +├── api +├── client-api-grants +│ └── cloud.foobar.me +│ ''' +│ com.example.hello # refers to /srv/walnut/packages/rest/com.example.hello +│ ''' +│ +├── pages +│ └── com.example.hello +│ └── index.html +│ ''' +│ +│ com.example.hello +│ +│

com.example.hello

+│ +│ +│ ''' +│ +├── rest +│ └── com.example.hello +│ ├── package.json +│ └── index.js +│ ''' +│ 'use strict'; +│ +│ module.exports.create = function (conf, deps, app) { +│ +│ app.use('/', function (req, res) { +│ console.log('[com.example.hello] req.url', req.url); +│ res.send({ message: 'hello' }); +│ }); +│ +│ return deps.Promise.resolve(); +│ }; +│ +│ ''' +│ +├── services +└── sites + └── daplie.me + ''' + com.example.hello # refers to /srv/walnut/packages/pages/com.example.hello + ''' ```