Move some items into a separate config file for easy setup

This commit is contained in:
Craine Runton 2016-05-24 17:04:50 -06:00
parent 1f4d5f0f77
commit f75a549aa1
2 changed files with 14 additions and 5 deletions

9
config.js Normal file
View File

@ -0,0 +1,9 @@
var config = {
connection_timeout : 5000,
output_file : {
path: './',
name: 'certificates.js'
}
};
module.exports = config;

View File

@ -7,13 +7,13 @@
var https = require('https');
const fs = require('fs');
const config = require('./config');
const monitored_hosts = require('./monitored_hosts');
const directory = process.argv[2]+'/';
const file_name = 'certificates.js';
const run_date = new Date().toDateString();
var output = {};
var iteration = 1;
var output = {},
iteration = 1,
errors = 0;
// Run the module
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
*/
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 (err) {
console.log('Error writing file. \n');