Skip to content

Commit

Permalink
refactor: Make source code file names consistent throughout Butler
Browse files Browse the repository at this point in the history
Implements #422
  • Loading branch information
mountaindude committed May 2, 2022
1 parent 5d6e19b commit 590285a
Show file tree
Hide file tree
Showing 35 changed files with 42 additions and 45 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ async function build(opts = {}) {

// Loads all plugins defined in routes
restServer.register(require('./routes/api'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/baseConversion'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/butlerPing'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/base_conversion'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/butler_ping'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/disk_utils'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/keyValueStore'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/mqttPublishMessage'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/key_value_store'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/mqtt_publish_message'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/scheduler'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/senseApp'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/senseAppDump'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/senseListApps'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/senseStartTask'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/slackPostMessage'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/sense_app'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/sense_app_dump'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/sense_list_apps'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/sense_start_task'), { options: Object.assign({}, opts) });
restServer.register(require('./routes/slack_post_message'), { options: Object.assign({}, opts) });

restServer.register(FastifySwagger, {
routePrefix: '/documentation',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/lib/service_uptime.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const moment = require('moment');
require('moment-precise-range-plugin');

const globals = require('../globals');
const postToInfluxdb = require('./post-to-influxdb');
const postToHttp = require('./post-to-new-relic');
const postToInfluxdb = require('./post_to_influxdb');
const postToHttp = require('./post_to_new_relic');

function serviceUptimeStart() {
const uptimeLogLevel = globals.config.get('Butler.uptimeMonitor.logLevel');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/qrs_util/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable global-require */
module.exports = {
senseStartTask: require('./senseStartTask'),
doesTaskExist: require('./doesTaskExist'),
getTasks: require('./getTasks'),
getAppOwner: require('./getAppOwner'),
senseStartTask: require('./sense_start_task'),
doesTaskExist: require('./does_task_exist'),
getTasks: require('./get_tasks'),
getAppOwner: require('./get_app_owner'),
customPropertyUtil: require('./task_cp_util'),
};
File renamed without changes.
2 changes: 1 addition & 1 deletion src/routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const httpErrors = require('http-errors');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiGetAPIEndpointsEnabled } = require('../api/api');

async function handlerGetAPIEndpointsEnabled(request, reply) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const anyBase = require('any-base');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { apiGetBase16ToBase62, apiGetBase62ToBase16 } = require('../api/baseConversion');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiGetBase16ToBase62, apiGetBase62ToBase16 } = require('../api/base_conversion');

const base62_to_Hex = anyBase('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', '0123456789abcdef');
const hex_to_base62 = anyBase('0123456789abcdef', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
Expand Down
4 changes: 2 additions & 2 deletions src/routes/butlerPing.js → src/routes/butler_ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const httpErrors = require('http-errors');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { apiGetButlerPing } = require('../api/butlerPing');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiGetButlerPing } = require('../api/butler_ping');

async function handlerGetButlerPing(request, reply) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/disk_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const mkdirp = require('mkdirp');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { logRESTCall } = require('../lib/log_rest_call');
const { isDirectoryChildOf } = require('../lib/disk_utils');
const { apiFileCopy, apiFileMove, apiFileDelete, apiCreateDir, apiCreateDirQvd } = require('../api/disk_utils');

Expand Down
8 changes: 4 additions & 4 deletions src/routes/keyValueStore.js → src/routes/key_value_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ const httpErrors = require('http-errors');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
// const kvStore = require('../lib/keyValueStore');
const { logRESTCall } = require('../lib/log_rest_call');

const {
getNamespaceList,
getNamespace,
deleteNamespace,
addKeyValuePair,
deleteKeyValuePair,
getValue,
} = require('../lib/keyValueStore');
} = require('../lib/key_value_store');
const {
apiGetAllNamespaces,
apiGetKVPair,
Expand All @@ -21,7 +21,7 @@ const {
apiDeleteKVPair,
apiDeleteNamespace,
apiGetKeysInNamespace,
} = require('../api/keyValueStore');
} = require('../api/key_value_store');

async function handlerGetNamespaceList(request, reply) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const httpErrors = require('http-errors');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { apiPutMqttMessage } = require('../api/mqttPublishMessage');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiPutMqttMessage } = require('../api/mqtt_publish_message');

// eslint-disable-next-line consistent-return
function handlerPutMqttMessage(request, reply) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const uuid = require('uuid');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { logRESTCall } = require('../lib/log_rest_call');
const scheduler = require('../lib/scheduler');
const {
apiGETSchedules,
Expand Down
4 changes: 2 additions & 2 deletions src/routes/senseApp.js → src/routes/sense_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const WebSocket = require('ws');
// Load global variables and functions
const globals = require('../globals');
const qrsUtil = require('../qrs_util');
const { logRESTCall } = require('../lib/logRESTCall');
const { apiPutAppReload } = require('../api/senseApp');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiPutAppReload } = require('../api/sense_app');

// Set up enigma.js configuration
// eslint-disable-next-line import/no-dynamic-require
Expand Down
4 changes: 2 additions & 2 deletions src/routes/senseAppDump.js → src/routes/sense_app_dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const enigma = require('enigma.js');
const WebSocket = require('ws');

const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { apiGetSenseAppDump, apiGetAppDump } = require('../api/senseAppDump');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiGetSenseAppDump, apiGetAppDump } = require('../api/sense_app_dump');

// Set up enigma.js configuration
// eslint-disable-next-line import/no-dynamic-require
Expand Down
4 changes: 2 additions & 2 deletions src/routes/senseListApps.js → src/routes/sense_list_apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const WebSocket = require('ws');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { apiGetSenseListApps, apiGetAppsList } = require('../api/senseListApps');
const { logRESTCall } = require('../lib/log_rest_call');
const { apiGetSenseListApps, apiGetAppsList } = require('../api/sense_list_apps');

// Set up enigma.js configuration
// eslint-disable-next-line import/no-dynamic-require
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const httpErrors = require('http-errors');
// Load global variables and functions
const globals = require('../globals');
const qrsUtil = require('../qrs_util');
const { logRESTCall } = require('../lib/logRESTCall');
const { addKeyValuePair } = require('../lib/keyValueStore');
const { apiPutStartTask } = require('../api/senseStartTask');
const { logRESTCall } = require('../lib/log_rest_call');
const { addKeyValuePair } = require('../lib/key_value_store');
const { apiPutStartTask } = require('../api/sense_start_task');
const { verifyTaskId } = require('../lib/config_util');

// Get array of allowed task IDs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const httpErrors = require('http-errors');

// Load global variables and functions
const globals = require('../globals');
const { logRESTCall } = require('../lib/logRESTCall');
const { logRESTCall } = require('../lib/log_rest_call');
const slackApi = require('../lib/slack_api');
const { apiPutSlackPostMessage } = require('../api/slackPostMessage');
const { apiPutSlackPostMessage } = require('../api/slack_post_message');

async function handlerPutSlackPostMessage(request, reply) {
try {
Expand Down
7 changes: 2 additions & 5 deletions src/udp/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/*eslint strict: ["error", "global"]*/

'use strict';

/* eslint-disable global-require */
module.exports = {
udp: require('./udp_handlers.js'),
udp: require('./udp_handlers'),
};
2 changes: 1 addition & 1 deletion src/udp/udp_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const slack = require('../lib/slack_notification');
const webhookOut = require('../lib/webhook_notification');
const msteams = require('../lib/msteams_notification');
const signl4 = require('../lib/incident_mgmt/signl4');
const newRelic = require('../lib/incident_mgmt/new-relic');
const newRelic = require('../lib/incident_mgmt/new_relic');
const { failedTaskStoreLogOnDisk } = require('../lib/scriptlog');

// Handler for failed scheduler initiated reloads
Expand Down

0 comments on commit 590285a

Please sign in to comment.