Skip to content

Repository files navigation

LdHostManager

Web tool to manage a LdHost instance

This examples assume you've run the LdHostManagerServer on port 3000:

$ runLdHostManager.js 3000 MyLdHostConfig.json

Configuration

LdHostManager is expected to be run with another web server which is responsible for the content. The LdHostManager server can be made available only through a reverse proxy (called "reverse" because "proxy" alone implies a Web client accelerator) side, e.g. through /MANAGE/ in the following Apache2 config:

<VirtualHost *:443>
  ServerName [My Server]
  DocumentRoot /var/www/
  ... [My SSL stuff] ...
  ProxyPass        /MANAGE/ http://127.0.0.1:3000/
  ProxyPassReverse /MANAGE/ http://127.0.0.1:3000/
  ...
</VirtualHost>

Acess control

Currently, LdHostManager has no authentication/access control as this is expected to be managed by the content server. If you want to allow access directly to LdHostManager, you can open a port à la:

ufw allow 3000

There is currently no access control implemented (see #2); PRs welcome.

Invocation

curl

getSites

To see headers and content and follow redirects:

curl -isL http://localhost:3000/sites

createSite

curl -X POST -s http://localhost:3000/createSite -d type=github -d owner=StaticFDP -d repo=Cotton

You'll get back a list of performed actions;

{"actions":["cloned http://github.com/StaticFDP/Cotton to github/StaticFDP/Cotton"]}

deleteSite

curl -X DELETE -s http://localhost:3002/deleteSite -d type=github -d owner=StaticFDP -d repo=Cotton
{"actions":["deleted Cotton"]}

updateSubdomain

You'll need to have created (and not deleted) the site before doing this.

curl -X POST -s http://localhost:3002/updateSubdomain -d type=github -d owner=StaticFDP -d repo=Cotton -d subdomain=cotton
{"actions":["linked cotton to github/StaticFDP/Cotton"]}

deleteSubdomain

curl -X DELETE -s http://localhost:3002/deleteSubdomain -d subdomain=cotton
{"actions":["deleted cotton"]}

delete

curl -X DELETE -s http://localhost:3002/deleteSubdomain -d subdomain=cotton
{"actions":["deleted cotton"]}

Debugging

Note ExpectProcessOutput's debugging, e.g.

DEBUG=\*,-babel\* ./node_modules/.bin/jest test/LdHostManager-curl.test.js
  test:LdHostManager-curl stderr has 1 expectors to match [[
  test:LdHostManager-curl 2023-09-26T07:21:44.414Z backend:server Listening on port 3002
  test:LdHostManager-curl
  test:LdHostManager-curl ]] +0ms
  test:LdHostManager-curl   0: /(backend:server Listening on port (\d+).*\n)/ +1ms
  test:LdHostManager-curl stdout has 1 expectors to match [[
  test:LdHostManager-curl { 'github/StaticFDP/wikidata': 'wikidata' }
  test:LdHostManager-curl
  test:LdHostManager-curl ]] +49ms
  test:LdHostManager-curl   0: /^(.*wikidata.*)$/s +1ms

About

Web tool to manage a LdHost instance

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages