"use strict";
var Cli = require("matrix-appservice-bridge").Cli;
var log = require("./lib/logging").get("CLI");
var main = require("./lib/main");

const REG_PATH = "appservice-registration-irc.yaml";

new Cli({
    registrationPath: REG_PATH,
    enableRegistration: true,
    enableLocalpart: true,
    bridgeConfig: {
        affectsRegistration: true,
        schema: "./lib/config/schema.yml",
        defaults: main.defaultConfig()
    },
    generateRegistration: function(reg, callback) {
        main.generateRegistration(reg, this.getConfig()).done(function(completeRegistration) {
            callback(completeRegistration);
        });
    },
    run: function(port, config, reg) {
        main.runBridge(port, config, reg).catch(function(err) {
            log.error("Failed to run bridge.");
            throw err;
        });
    }
}).run();

"use strict";
var Cli = require("matrix-appservice-bridge").Cli;
var log = require("./lib/logging").get("CLI");
var main = require("./lib/main");
var path = require("path");

const REG_PATH = "appservice-registration-irc.yaml";

new Cli({
    registrationPath: REG_PATH,
    enableRegistration: true,
    enableLocalpart: true,
    bridgeConfig: {
        affectsRegistration: true,
        schema: path.join(__dirname, "lib/config/schema.yml"),
        defaults: main.defaultConfig()
    },
    generateRegistration: function(reg, callback) {
        main.generateRegistration(reg, this.getConfig()).done(function(completeRegistration) {
            callback(completeRegistration);
        });
    },
    run: function(port, config, reg) {
        main.runBridge(port, config, reg).catch(function(err) {
            log.error("Failed to run bridge.");
            throw err;
        });
    }
}).run();

Make config schema path to be relative to installation directory.
Make config schema path to be relative to installation directory.

This changed fixes wrong assumption that working directory of IRC bridge
is always a directory where it's installed.

Schema path has been changed to be relative to installation directory,
not working directory.

Signed-off-by: Oleg Girko <665b39a1e96a9a15fc99f73183af3f04bf8111eb@infoserver.lv>
