Move some items into a separate config file for easy setup
This commit is contained in:
parent
1f4d5f0f77
commit
f75a549aa1
9
config.js
Normal file
9
config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
var config = {
|
||||||
|
connection_timeout : 5000,
|
||||||
|
output_file : {
|
||||||
|
path: './',
|
||||||
|
name: 'certificates.js'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
var https = require('https');
|
var https = require('https');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const config = require('./config');
|
||||||
const monitored_hosts = require('./monitored_hosts');
|
const monitored_hosts = require('./monitored_hosts');
|
||||||
|
|
||||||
const directory = process.argv[2]+'/';
|
|
||||||
const file_name = 'certificates.js';
|
|
||||||
const run_date = new Date().toDateString();
|
const run_date = new Date().toDateString();
|
||||||
var output = {};
|
var output = {},
|
||||||
var iteration = 1;
|
iteration = 1,
|
||||||
|
errors = 0;
|
||||||
|
|
||||||
// Run the module
|
// Run the module
|
||||||
monitored_hosts.forEach(get_cert_parameters)
|
monitored_hosts.forEach(get_cert_parameters)
|
||||||
@ -105,7 +105,7 @@ function check_iterations() {
|
|||||||
* Writes out the final object to a file, along with the run date to be used by the HTML page later
|
* Writes out the final object to a file, along with the run date to be used by the HTML page later
|
||||||
*/
|
*/
|
||||||
function write_results() {
|
function write_results() {
|
||||||
fs.writeFile(directory+file_name, 'var run_date = \''+run_date+'\'; \nvar cert_info = '+JSON.stringify(output, null, 2), function(err) {
|
fs.writeFile(config.output_file.path+config.output_file.name, 'var run_date = \''+run_date+'\'; \nvar cert_info = '+JSON.stringify(output, null, 2), function(err) {
|
||||||
// If the write errored out, notify
|
// If the write errored out, notify
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('Error writing file. \n');
|
console.log('Error writing file. \n');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user