Commit 18c6f924d15dd29b7993d8f1b8b507533bdcec73
1 parent
c8d1761567
Exists in
master
Init config.smstools.json
Showing 3 changed files with 13 additions and 0 deletions Inline Diff
.gitignore
1 | /node_modules/ | 1 | /node_modules/ |
2 | /config.json | 2 | /config.json |
3 | /config.smstools.json | ||
3 | /tmp/ | 4 | /tmp/ |
4 | /logs/ | 5 | /logs/ |
5 | config_*.json | 6 | config_*.json |
6 | pid.txt | 7 | pid.txt |
7 | 8 |
index.js
1 | process.chdir(__dirname); | 1 | process.chdir(__dirname); |
2 | 2 | ||
3 | const fs = require('fs'); | 3 | const fs = require('fs'); |
4 | 4 | ||
5 | fs.writeFileSync('pid.txt', process.pid); | 5 | fs.writeFileSync('pid.txt', process.pid); |
6 | 6 | ||
7 | const config = require('komodo-sdk/config'); | 7 | const config = require('komodo-sdk/config'); |
8 | 8 | ||
9 | global.KOMODO_LOG_LABEL = `KOMODO-CENTER@${(config && typeof config.name === 'string') ? config.name.toUpperCase() : 'SMSTOOLS'}`; | 9 | global.KOMODO_LOG_LABEL = `KOMODO-CENTER@${(config && typeof config.name === 'string') ? config.name.toUpperCase() : 'SMSTOOLS'}`; |
10 | process.title = global.KOMODO_LOG_LABEL; | 10 | process.title = global.KOMODO_LOG_LABEL; |
11 | 11 | ||
12 | require('./lib/smstools-configurator'); | ||
12 | require('./lib/apiserver'); | 13 | require('./lib/apiserver'); |
13 | 14 | ||
14 | const messagingClient = require('komodo-center-messaging-client-lib'); | 15 | const messagingClient = require('komodo-center-messaging-client-lib'); |
15 | const transport = require('./lib/transport'); | 16 | const transport = require('./lib/transport'); |
16 | 17 | ||
17 | messagingClient.setTransport(transport); | 18 | messagingClient.setTransport(transport); |
18 | 19 |
lib/smstools-configurator/index.js
1 | const fs = require('fs'); | ||
2 | const logger = require('komodo-sdk/logger'); | ||
3 | |||
4 | if (!fs.existsSync('config.smstools.json')) { | ||
5 | logger.info('config.smstools.json does not exists, creating it'); | ||
6 | fs.writeFileSync('config.smstools.json', JSON.stringify({}, 0, 4)); | ||
7 | } | ||
8 | |||
9 | const smstoolsConfig = require('../../config.smstools.json'); | ||
10 | |||
11 | logger.info('Our SMSTOOLS config read', { smstoolsConfig }); | ||
12 |