disarm-dev / douma-api

DiSARM api (2018 and beyond)
MIT License
2 stars 1 forks source link

DOUMA API

coverage report

Issues

Please create a new issue if you encounter any bugs.

Deployment

This is the server for DiSARM. Users will require access to a configured and deployed client application.

Required software

  1. Download and install nodejs (https://nodejs.org/en/download/)
  2. Download and install mongodb (https://docs.mongodb.com/manual/installation/)
  3. Start mongodb server process
  4. Clone this repository (git clone https://gitlab.com/disarm/douma.api douma-api)

Required domain

The client application is served over HTTPS, so any requests made (e.g. to this API) must also be served from a domain using HTTPS. For core instance servers, DiSARM can make a proxy server available.

The domain name needs to be provided to the client application.

It's possible to automatically configure it via a URL parameter, something like https://zwe-mats.api.disarm.io#api_url=https://zwe.api.disarm.io. This assumes the API server is available through https://zwe.api.disarm.io

Configuration

  1. Go to douma-api directory and install node packages:

    npm install
  2. Set SECRET environment variable to any string. It will be used for user API keys generation.

  3. Set MONGODB_URI environment variable to URI of your mongodb installation. For local installation that could be:

    mongodb://localhost/douma
  4. Set SHEETS_URL environment variable to URI of your users CSV file if you store it remotely. Alternatively use SHEETS_PATH environment variable to point to CSV file in your local filesystem.

Starting the server

  1. Start the server:
    npm run start

Managing users

You will need to create users.csv file with all your users. Make sure to set either SHEETS_URL or SHEETS_PATH environment variable.

Updating the server after editing users

Make a call to the /v4/refresh_users route. You should get a success message back.

Required columns and types

The following are required:

List of applets

Database admin and backups

Please ensure sound practices are in place for backing up data.

Development

Need the same configuration as for production (see above).

Install rerun Gem, using gem install rerun, or pick another way to reload server.

Public paths

Need to

  1. Include in openPaths array
  2. Ensure the path is referenced in an addPermissions call, with a wildcard permission: e.g. addPermission('get', v(''), ['*'])