#!/usr/bin/node

/**
 * A minimalist mock-up of the ASAQC server, used
 * for testing.
 *
 * Use the following environment variables to
 * configure its behaviour:
 *
 * ASAQC_DUMMY_OUTPUT_DIR Path to a directory in which
 * to store the received data. If not provided, the
 * data will be discarded but the API will still return
 * a success code. Alternatively, a path may be given
 * in the command line.
 *
 * See also api/index.js for other environment
 * variable options.
 *
 * Example command line:
 *
 * HTTPS_CA="./certs/client.pem" HTTPS_PEM="./certs/dougal.pem" ./index.js ./store
 *
 */

const api = require('./api');

const OUTPUT_DIR = process.argv[2] || process.env.ASAQC_DUMMY_OUTPUT_DIR;

const server = api.start(process.env.HTTP_PORT || 3077, process.env.HTTP_PATH, {OUTPUT_DIR});
