aboutsummaryrefslogtreecommitdiff
path: root/api/settings/index.js
blob: 49b4084933a8ef1b4c8fbf10a16c598bf50bc2b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { spawnSync } = require('child_process');

function get_api_bindToIP_value()
{
    const command = spawnSync("ak-settings", ["--get", "api.bindToIP"]);
    var ip_to_bind_onto = command.stdout;
    if ( command.status !== 0 ) {
        return 1;
    } else {
        return ip_to_bind_onto;
    }
}

function return_settings()
{
    const ip = get_api_bindToIP_value();
    const port = 8610;
    const url_prefix = "/v0";
    const protocol = "http://";

    return JSON.parse(JSON.stringify({
        "DEF_PROTO": `${protocol}`,
        "LOCAL_IP": `${ip}`,
        "PORT": `${port}`,
        "URL_PREFIX": `${url_prefix}`
    }));
}

module.exports = return_settings;