Skip to content
Snippets Groups Projects
Commit dff4076f authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Allow config file (alternate sbbsecho .ini file) to be passed on cmdline

Back in the day, some sysops used to use multiple SBBSecho configuration files.
Nobody seems to do that these days, but its certainly a viable solution (or
should be) for multiple FTNs on a single BBS. Anyway, this enhancement allows
BinkIT to use an alternate SBBSecho configuration file (though it must still
be located in the ctrl dir).
parent d4966806
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -26,6 +26,7 @@ var version_notice = "BinkIT/" + REVISION; ...@@ -26,6 +26,7 @@ var version_notice = "BinkIT/" + REVISION;
var semaphores = []; var semaphores = [];
// data/binkstats.ini // data/binkstats.ini
var stats = { inbound: { true: {}, false: {} }, callout: { true: {}, false: {} }, totals: {} }; var stats = { inbound: { true: {}, false: {} }, callout: { true: {}, false: {} }, totals: {} };
var cfgfname;
function update_stats(stats, addr, bp, host) function update_stats(stats, addr, bp, host)
{ {
...@@ -609,7 +610,7 @@ function callout(addr, scfg, locks, bicfg) ...@@ -609,7 +610,7 @@ function callout(addr, scfg, locks, bicfg)
log(LOG_INFO, format("%s callout to %s started", bp.revision, addr)); log(LOG_INFO, format("%s callout to %s started", bp.revision, addr));
if (bicfg === undefined) if (bicfg === undefined)
bicfg = new BinkITCfg(); bicfg = new BinkITCfg(cfgfname);
bp.system_operator = bicfg.sysop; bp.system_operator = bicfg.sysop;
bp.plain_auth_only = bicfg.plain_auth_only; bp.plain_auth_only = bicfg.plain_auth_only;
bp.crypt_support = bicfg.crypt_support; bp.crypt_support = bicfg.crypt_support;
...@@ -845,8 +846,8 @@ function run_outbound(ran) ...@@ -845,8 +846,8 @@ function run_outbound(ran)
var scfg_ob; var scfg_ob;
log(LOG_DEBUG, "Running outbound"); log(LOG_DEBUG, "Running outbound");
scfg = new SBBSEchoCfg(); scfg = new SBBSEchoCfg(cfgfname);
bicfg = new BinkITCfg(); bicfg = new BinkITCfg(cfgfname);
if (!scfg.is_flo) { if (!scfg.is_flo) {
log(LOG_ERROR, "sbbsecho not configured for FLO-style mailers."); log(LOG_ERROR, "sbbsecho not configured for FLO-style mailers.");
...@@ -1011,8 +1012,8 @@ function run_inbound(sock) ...@@ -1011,8 +1012,8 @@ function run_inbound(sock)
log(LOG_INFO, bp.revision + " inbound connection from " +sock.remote_ip_address+":"+sock.remote_port); log(LOG_INFO, bp.revision + " inbound connection from " +sock.remote_ip_address+":"+sock.remote_port);
bp.cb_data = { bp.cb_data = {
binkitcfg:new BinkITCfg(), binkitcfg:new BinkITCfg(cfgfname),
binkit_scfg:new SBBSEchoCfg(), binkit_scfg:new SBBSEchoCfg(cfgfname),
binkit_file_actions:{}, binkit_file_actions:{},
binkit_flow_contents:{}, binkit_flow_contents:{},
binkit_locks:locks binkit_locks:locks
...@@ -1057,7 +1058,7 @@ function poll_node(addr_str, scfg, bicfg, myaddr) ...@@ -1057,7 +1058,7 @@ function poll_node(addr_str, scfg, bicfg, myaddr)
var locks = []; var locks = [];
if (scfg === undefined) if (scfg === undefined)
scfg = new SBBSEchoCfg(); scfg = new SBBSEchoCfg(cfgfname);
if (myaddr === undefined) if (myaddr === undefined)
myaddr = FIDO.parse_addr(system.fido_addr_list[0], 1, 'fidonet'); myaddr = FIDO.parse_addr(system.fido_addr_list[0], 1, 'fidonet');
...@@ -1092,8 +1093,8 @@ function run_polls(ran) ...@@ -1092,8 +1093,8 @@ function run_polls(ran)
var locks = []; var locks = [];
log(LOG_DEBUG, "Running polls"); log(LOG_DEBUG, "Running polls");
scfg = new SBBSEchoCfg(); scfg = new SBBSEchoCfg(cfgfname);
bicfg = new BinkITCfg(); bicfg = new BinkITCfg(cfgfname);
myaddr = FIDO.parse_addr(system.fido_addr_list[0], 1, 'fidonet'); myaddr = FIDO.parse_addr(system.fido_addr_list[0], 1, 'fidonet');
Object.keys(bicfg.node).forEach(function(addr_str) { Object.keys(bicfg.node).forEach(function(addr_str) {
...@@ -1194,6 +1195,11 @@ if (system.fido_addr_list.length < 1) { ...@@ -1194,6 +1195,11 @@ if (system.fido_addr_list.length < 1) {
exit(1); exit(1);
} }
for (i = 0; i < argv.length; i++) {
if(file_getext(argv[i]) == ".ini")
cfgfname = argv[i];
}
// If we're running as a service, call run_inbound(). // If we're running as a service, call run_inbound().
if (sock !== undefined && sock.descriptor !== -1) if (sock !== undefined && sock.descriptor !== -1)
run_inbound(sock); run_inbound(sock);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment