"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cactus_common_1 = require("@hyperledger/cactus-common");
const tape_1 = __importDefault(require("tape-promise/tape"));
const public_api_1 = require("../../../../main/typescript/public-api");
const public_api_2 = require("../../../../main/typescript/public-api");
tape_1.default("Generates valid example config for the API server", async (t) => {
    const configService = new public_api_2.ConfigService();
    t.ok(configService, "Instantiated ConfigService truthy OK");
    const exampleConfig = configService.newExampleConfig();
    t.ok(exampleConfig, "configService.newExampleConfig() truthy OK");
    // FIXME - this hack should not be necessary, we need to re-think how we
    // do configuration parsing. The convict library may not be the path forward.
    exampleConfig.authorizationConfigJson = JSON.stringify(exampleConfig.authorizationConfigJson);
    exampleConfig.configFile = "";
    const convictConfig = configService.newExampleConfigConvict(exampleConfig);
    t.ok(convictConfig, "configService.newExampleConfigConvict() truthy OK");
    const config = convictConfig.getProperties();
    t.ok(config, "convictConfig.getProperties() truthy OK");
    cactus_common_1.LoggerProvider.setLogLevel(config.logLevel);
    const apiServer = new public_api_1.ApiServer({ config });
    await apiServer.start();
    tape_1.default.onFinish(() => apiServer.shutdown());
    t.end();
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLXNlcnZpY2UtZXhhbXBsZS1jb25maWctdmFsaWRpdHkudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy90ZXN0L3R5cGVzY3JpcHQvdW5pdC9jb25maWcvY29uZmlnLXNlcnZpY2UtZXhhbXBsZS1jb25maWctdmFsaWRpdHkudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhEQUE0RDtBQUM1RCw2REFBK0M7QUFHL0MsdUVBQW1FO0FBQ25FLHVFQUF1RTtBQUV2RSxjQUFJLENBQUMsbURBQW1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