Commit f24458bdb8bd29e8b25768325b8929643ba28b69
1 parent
b708801611
Exists in
master
Queues and providers gona test
Showing 2 changed files with 16 additions and 2 deletions Side-by-side Diff
bin/smstools-config-install
lib/smstools-config/creator.js
... | ... | @@ -2,6 +2,7 @@ const moment = require('moment'); |
2 | 2 | const config = require('komodo-sdk/config'); |
3 | 3 | const { orderBy } = require('natural-orderby'); |
4 | 4 | const smstoolsConfig = require('./config-file'); |
5 | +const queuesAndProviders = require('./queues-and-providers'); | |
5 | 6 | |
6 | 7 | function modemNames() { |
7 | 8 | const modems = []; |
... | ... | @@ -21,10 +22,19 @@ function modemEntries() { |
21 | 22 | modems.forEach((modemName) => { |
22 | 23 | const modem = smstoolsConfig.modems[modemName]; |
23 | 24 | |
25 | + let queuesLine = ''; | |
26 | + if (queuesAndProviders.hasQueues()) { | |
27 | + const queues = queuesAndProviders.getModemQueueName(modemName); | |
28 | + if (queues && queues.length) { | |
29 | + queuesLine = `queues = ${queues.join(', ')}`; | |
30 | + } | |
31 | + } | |
32 | + | |
24 | 33 | const modemEntry = ` |
25 | 34 | [${modemName}] |
26 | 35 | device = ${modem.device} |
27 | 36 | outgoing = ${modem.outgoing ? 'yes' : 'no'} |
37 | +${queuesLine} | |
28 | 38 | `.trim(); |
29 | 39 | |
30 | 40 | retval.push(modemEntry); |
... | ... | @@ -33,7 +43,9 @@ outgoing = ${modem.outgoing ? 'yes' : 'no'} |
33 | 43 | return retval; |
34 | 44 | } |
35 | 45 | |
36 | -module.exports = () => { | |
46 | +module.exports = async () => { | |
47 | + const queuesAndProvidersStr = queuesAndProviders.hasQueues() ? (await queuesAndProviders.dump()) : ''; | |
48 | + | |
37 | 49 | const newContent = ` |
38 | 50 | # Generated by komodo-center-smstools based on config timestamp ${moment(smstoolsConfig.ts).format('YYYY-MM-DD HH:mm:ss')} |
39 | 51 | # Do not edit this file manually |
... | ... | @@ -55,6 +67,8 @@ sent = /var/spool/sms/sent |
55 | 67 | failed = /var/spool/sms/failed |
56 | 68 | ${smstoolsConfig.customConfig || ''} |
57 | 69 | |
70 | +${queuesAndProvidersStr} | |
71 | + | |
58 | 72 | [default] |
59 | 73 | sentsleeptime = ${config.smstools_sentsleeptime || 0} |
60 | 74 | send_delay = ${config.smstools_send_delay || 0} |