Skip to content

Commit 8328f02

Browse files
authored
Merge pull request #1217 from mountaindude/1199
1199
2 parents aaf414e + 2960da0 commit 8328f02

13 files changed

+2196
-2063
lines changed

eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import prettier from 'eslint-plugin-prettier';
2+
import globals from 'globals';
3+
import path from 'node:path';
4+
import { fileURLToPath } from 'node:url';
5+
import js from '@eslint/js';
6+
import { FlatCompat } from '@eslint/eslintrc';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all,
14+
});
15+
16+
// export default [...compat.extends("airbnb-base", "prettier"), {
17+
export default [
18+
...compat.extends('prettier'),
19+
{
20+
plugins: {
21+
prettier,
22+
},
23+
24+
languageOptions: {
25+
globals: {
26+
...globals.node,
27+
},
28+
29+
ecmaVersion: 12,
30+
sourceType: 'module',
31+
},
32+
33+
rules: {
34+
'prettier/prettier': 'error',
35+
},
36+
},
37+
];

package-lock.json

Lines changed: 365 additions & 1168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,18 @@
5555
"@fastify/reply-from": "^9.8.0",
5656
"@fastify/sensible": "^5.6.0",
5757
"@fastify/static": "^7.0.4",
58-
"@fastify/swagger": "^8.14.0",
59-
"@fastify/swagger-ui": "^4.0.1",
58+
"@fastify/swagger": "^8.15.0",
59+
"@fastify/swagger-ui": "^4.1.0",
6060
"@keyvhq/core": "^2.1.1",
6161
"@xstate/fsm": "^2.0.1",
6262
"any-base": "^1.1.0",
63-
"axios": "^1.7.2",
63+
"axios": "^1.7.5",
6464
"commander": "^12.1.0",
6565
"config": "^3.3.12",
6666
"cron-job-manager": "^2.3.1",
6767
"email-validator": "^2.0.4",
6868
"enigma.js": "^2.14.0",
69-
"esbuild": "^0.23.0",
70-
"eslint": "^8.5.7",
71-
"eslint-config-airbnb-base": "^15.0.0",
72-
"eslint-config-prettier": "^9.1.0",
73-
"eslint-plugin-prettier": "^5.2.1",
69+
"esbuild": "^0.23.1",
7470
"express-handlebars": "^7.1.3",
7571
"fastify": "^4.28.1",
7672
"fastify-healthcheck": "^4.4.0",
@@ -81,39 +77,41 @@
8177
"i": "^0.3.7",
8278
"influx": "^5.9.3",
8379
"is-unc-path": "^1.0.0",
84-
"jjsontree.js": "^2.1.0",
80+
"jjsontree.js": "^2.9.0",
8581
"js-yaml": "^4.1.0",
8682
"jshint": "^2.13.6",
8783
"lodash": "^4.17.21",
88-
"luxon": "^3.4.4",
84+
"luxon": "^3.5.0",
8985
"mkdirp": "^3.0.1",
9086
"moment": "^2.30.1",
9187
"moment-precise-range-plugin": "^1.3.0",
92-
"mqtt": "^5.8.1",
88+
"mqtt": "^5.10.0",
9389
"ms-teams-wrapper": "^1.0.2",
9490
"nodemailer": "^6.9.14",
9591
"nodemailer-express-handlebars": "^6.1.2",
9692
"os": "^0.1.2",
97-
"posthog-node": "^4.0.1",
93+
"posthog-node": "^4.2.0",
9894
"promise": "^8.3.0",
9995
"qrs-interact": "^6.3.1",
10096
"rate-limiter-flexible": "^5.0.3",
10197
"serializeapp": "^3.0.0",
102-
"systeminformation": "^5.22.11",
98+
"systeminformation": "^5.23.5",
10399
"upath": "^2.0.1",
104100
"uuid": "^10.0.0",
105-
"winston": "^3.13.1",
101+
"winston": "^3.14.2",
106102
"winston-daily-rotate-file": "^5.0.0",
107103
"ws": "^8.18.0",
108-
"xstate": "^5.15.0"
104+
"xstate": "^5.17.4"
109105
},
110106
"devDependencies": {
111-
"@babel/eslint-parser": "^7.24.8",
107+
"@babel/eslint-parser": "^7.25.1",
112108
"@babel/plugin-syntax-import-assertions": "^7.24.7",
113-
"eslint-plugin-import": "^2.29.1",
109+
"@eslint/js": "^9.9.0",
110+
"eslint-config-prettier": "^9.1.0",
111+
"eslint-plugin-prettier": "^5.2.1",
114112
"jest": "^29.7.0",
115113
"prettier": "^3.3.3",
116-
"snyk": "^1.1292.1"
114+
"snyk": "^1.1292.4"
117115
},
118116
"pkg": {
119117
"assets": [

src/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ async function build(opts = {}) {
343343
const dirContents = fs.readdirSync(globals.appBasePath);
344344
globals.logger.verbose(`CONFIG VIS: Directory contents of "${globals.appBasePath}": ${dirContents}`);
345345

346-
347346
const htmlDir = path.resolve(globals.appBasePath, 'static/configvis');
348347
globals.logger.info(`CONFIG VIS: Serving static files from ${htmlDir}`);
349348

src/config/config-gen-api-docs.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ Butler:
1212
# More info on whata data is collected: https://butler.ptarmiganlabs.com/docs/about/telemetry/
1313
# Please consider leaving this at true - it really helps future development of Butler!
1414

15+
# Should Butler start a web server that serves an obfuscated view of the Butler config file?
16+
configVisualisation:
17+
enable: false
18+
host: localhost # Hostname or IP address where the web server will listen. Should be localhost in most cases.
19+
port: 3100 # Port where the web server will listen. Change if port 3100 is already in use.
20+
obfuscate: true # Should the config file shown in the web UI be obfuscated?
21+
1522
# Heartbeats can be used to send "I'm alive" messages to any other tool, e.g. an infrastructure monitoring tool
1623
heartbeat:
1724
enable: false
@@ -805,13 +812,6 @@ Butler:
805812
webhook:
806813
enable: false
807814

808-
# Should Butler start a web server that serves an obfuscated view of the Butler config file?
809-
configVisualisation:
810-
enable: false
811-
host: localhost # Hostname or IP address where the web server will listen. Should be localhost in most cases.
812-
port: 3100 # Port where the web server will listen. Change if port 3100 is already in use.
813-
obfuscate: true # Should the config file shown in the web UI be obfuscated?
814-
815815
# Certificates to use when connecting to Sense. Get these from the Certificate Export in QMC.
816816
cert:
817817
clientCert: ...

src/config/production_template.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ Butler:
2525
# More info on whata data is collected: https://butler.ptarmiganlabs.com/docs/about/telemetry/
2626
# Please consider leaving this at true - it really helps future development of Butler!
2727

28+
# Should Butler start a web server that serves an obfuscated view of the Butler config file?
29+
configVisualisation:
30+
enable: true
31+
host: localhost # Hostname or IP address where the web server will listen. Should be localhost in most cases.
32+
port: 3100 # Port where the web server will listen. Change if port 3100 is already in use.
33+
obfuscate: true # Should the config file shown in the web UI be obfuscated?
34+
2835
# Heartbeats can be used to send "I'm alive" messages to any other tool, e.g. an infrastructure monitoring tool
2936
heartbeat:
3037
enable: false
@@ -914,13 +921,6 @@ Butler:
914921
webhook: # Send service alerts as outbound webhooks/http calls
915922
enable: true
916923

917-
# Should Butler start a web server that serves an obfuscated view of the Butler config file?
918-
configVisualisation:
919-
enable: true
920-
host: localhost # Hostname or IP address where the web server will listen. Should be localhost in most cases.
921-
port: 3100 # Port where the web server will listen. Change if port 3100 is already in use.
922-
obfuscate: true # Should the config file shown in the web UI be obfuscated?
923-
924924
# Certificates to use when connecting to Sense. Get these from the Certificate Export in QMC.
925925
cert:
926926
clientCert: <path/to/cert/client.pem>

src/lib/assert/assert_config_file.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,27 @@ export const configFileStructureAssert = async (config, logger) => {
489489
configFileCorrect = false;
490490
}
491491

492+
// Config visualisation setttings
493+
if (!config.has('Butler.configVisualisation.enable')) {
494+
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.enable"');
495+
configFileCorrect = false;
496+
}
497+
498+
if (!config.has('Butler.configVisualisation.host')) {
499+
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.host"');
500+
configFileCorrect = false;
501+
}
502+
503+
if (!config.has('Butler.configVisualisation.port')) {
504+
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.port"');
505+
configFileCorrect = false;
506+
}
507+
508+
if (!config.has('Butler.configVisualisation.obfuscate')) {
509+
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.obfuscate"');
510+
configFileCorrect = false;
511+
}
512+
492513
if (!config.has('Butler.heartbeat.enable')) {
493514
logger.error('ASSERT CONFIG: Missing config file entry "Butler.heartbeat.enable"');
494515
configFileCorrect = false;
@@ -4951,27 +4972,6 @@ export const configFileStructureAssert = async (config, logger) => {
49514972
configFileCorrect = false;
49524973
}
49534974

4954-
// Config visualisation setttings
4955-
if (!config.has('Butler.configVisualisation.enable')) {
4956-
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.enable"');
4957-
configFileCorrect = false;
4958-
}
4959-
4960-
if (!config.has('Butler.configVisualisation.host')) {
4961-
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.host"');
4962-
configFileCorrect = false;
4963-
}
4964-
4965-
if (!config.has('Butler.configVisualisation.port')) {
4966-
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.port"');
4967-
configFileCorrect = false;
4968-
}
4969-
4970-
if (!config.has('Butler.configVisualisation.obfuscate')) {
4971-
logger.error('ASSERT CONFIG: Missing config file entry "Butler.configVisualisation.obfuscate"');
4972-
configFileCorrect = false;
4973-
}
4974-
49754975
if (!config.has('Butler.cert.clientCert')) {
49764976
logger.error('ASSERT CONFIG: Missing config file entry "Butler.cert.clientCert"');
49774977
configFileCorrect = false;

src/lib/config_obfuscate.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ function configObfuscate(config) {
44
try {
55
const obfuscatedConfig = { ...config };
66

7+
// Obfuscate Butler.configVisualisation.host, keep first 3 chars, mask the rest with *
8+
obfuscatedConfig.Butler.configVisualisation.host =
9+
obfuscatedConfig.Butler.configVisualisation.host.substring(0, 3) + '*'.repeat(10);
10+
711
// Keep first 10 chars of remote URL, mask the rest with *
812
obfuscatedConfig.Butler.heartbeat.remoteURL = obfuscatedConfig.Butler.heartbeat.remoteURL.substring(0, 10) + '*'.repeat(10);
913

static/configvis/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<html lang="en">
44
<head>
5-
<title>Ctrl-Q</title>
5+
<title>Butler</title>
66

77
<link rel="stylesheet" href="jsontree.js.css" />
88
<script src="jsontree.js"></script>
@@ -182,9 +182,8 @@ <h3>JSON tree view</h3>
182182
sortPropertyNames: false,
183183
sortPropertyNamesInAlphabeticalOrder: false,
184184
data: {{butlerConfigJsonEncoded}} }"
185-
style="width: 100%"
185+
style="width: 100%; max-width: 100%"
186186
>
187-
Your HTML.
188187
</div>
189188
</div>
190189

0 commit comments

Comments
 (0)