Skip to content

Commit

Permalink
feat: log at startup which config file is used
Browse files Browse the repository at this point in the history
feat: log at startup current API rate limit
  • Loading branch information
Göran Sander committed May 27, 2023
1 parent b98d473 commit 2fd7055
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ jobs:
node butler.js -c ./config/config-gen-api-docs.yaml --no-qs-connection &
sleep 20
echo "...1"
curl localhost:8081/documentation/json
echo "...2"
curl localhost:8081/documentation/yaml
echo "...3"
curl localhost:8081/documentation/json > ../docs/api_doc/butler-api.json
echo "...4"
curl localhost:8081/documentation/yaml > ../docs/api_doc/butler-api.yaml
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"NODE_ENV": "production"
},
"args": [
// "--configfile",
// "config/production.yaml",
"--configfile",
"config/production.yaml",
// "--new-relic-account-name",
// "'First NR account'",
// "--new-relic-account-id",
Expand Down
4 changes: 4 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ async function build(opts = {}) {
globals.logger.info(`Cores : ${globals.hostInfo.si.cpu.cores}`);
globals.logger.info(`Docker arch. : ${globals.hostInfo.si.cpu.hypervizor}`);
globals.logger.info(`Total memory : ${globals.hostInfo.si.memory.total}`);
globals.logger.info('');
// Add log line with name of config file
globals.logger.info(`Config file : ${globals.configFileExpanded}`);
globals.logger.info(`API rate limit : ${globals.options.apiRateLimit}`);
globals.logger.info('--------------------------------------');

// Log info about what Qlik Sense certificates are being used
Expand Down
1 change: 1 addition & 0 deletions src/butler.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const dgram = require('dgram');
const globals = require('./globals');
const serviceMonitor = require('./lib/service_monitor');

// The build function creates a new instance of the App class and returns it.
const build = require('./app');
const udp = require('./udp');

Expand Down
2 changes: 1 addition & 1 deletion src/config/production_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ Butler:
enable: true # Main on/off switch for service monitoring
frequency: every 30 seconds # https://bunkat.github.io/later/parsers.html
monitor:
- host: <hostname or IP> emo # Host name of Windows computer where services are running
- host: <hostname or IP> # Host name of Windows computer where services are running
services: # List of services to monitor
- postgresql-x64-12 # Posgress/repository db
- QlikSenseEngineService
Expand Down
2 changes: 2 additions & 0 deletions src/docker-healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const optionsHealth = {
timeout: 2000,
};

// This code checks the health of the docker container using the docker api
// It checks the status code of the response and returns an exit code of 0 if the response is 200 and 1 otherwise
const requestHealth = httpHealth.request(optionsHealth, (res) => {
console.log(`STATUS Docker health: ${res.statusCode}`);
if (res.statusCode === 200) {
Expand Down
7 changes: 7 additions & 0 deletions src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ if (options.configfile && options.configfile.length > 0) {
console.log('Error: Specified config file does not exist');
process.exit(1);
}
} else {
// Get value of env variable NODE_ENV
const env = process.env.NODE_ENV;

// Get path to config file
configFileExpanded = upath.resolve(__dirname, `./config/${env}.yaml`);
}

// Are we running as standalone app or not?
Expand Down Expand Up @@ -586,6 +592,7 @@ async function initHostInfo() {
module.exports = {
config,
configEngine,
configFileExpanded,
configQRS,
teamsTaskFailureObj,
teamsTaskAbortedObj,
Expand Down

0 comments on commit 2fd7055

Please sign in to comment.