Commit 66c54ac
committed
fix: address all CodeRabbit + Bugbot review comments
src/db.js:
- Add pool.on('error') handler to prevent unhandled errors crashing process
- Make SSL configurable via DB_SSL_REJECT_UNAUTHORIZED env var
(defaults to rejectUnauthorized:true instead of insecure false)
- Add re-entrancy guard to initDb to prevent double initialization
- Clean up pool on init failure so getPool() doesn't return broken instance
- Wrap closeDb in try/catch so shutdown errors don't crash
src/modules/config.js:
- Remove process.exit from loadConfigFromFile — always throw instead
(no runtime code path should hard-exit the process)
- Remove unused getConfigSection export (dead code)
- Remove unused sectionConfig variable (dead store in setConfigValue)
- Fix cache-before-DB-write: write to database first, then update cache
- Fix concurrent section writes: use transaction with FOR UPDATE row lock
- Fix deep nested paths: read-modify-write in JS instead of jsonb_set
(jsonb_set silently drops updates when intermediate keys don't exist)
- Fix parseValue: preserve large numeric strings beyond MAX_SAFE_INTEGER
- Wrap DB seeding in transaction to prevent partial config loss on restart
src/commands/config.js:
- Fix collectConfigPaths to emit leaf-only entries (was emitting branches too)
- Derive valid sections from live config instead of hardcoded VALID_SECTIONS
- Fix 'New Value' display: traverse full dot-path instead of only first key
(path.split('.').slice(1)[0] broke for paths deeper than section.key)
- Add embed 6000-char limit guard with truncation notice
- Switch section options to autocomplete (derived from live config)
src/index.js:
- Wrap closeDb in try/catch in gracefulShutdown
README.md:
- Change json code block to jsonc (has // comments)1 parent 84f5ed3 commit 66c54ac
5 files changed
Lines changed: 318 additions & 150 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 21 | + | |
31 | 22 | | |
32 | 23 | | |
33 | 24 | | |
| |||
57 | 48 | | |
58 | 49 | | |
59 | 50 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 51 | + | |
68 | 52 | | |
69 | 53 | | |
70 | 54 | | |
71 | 55 | | |
72 | 56 | | |
73 | 57 | | |
74 | | - | |
75 | | - | |
| 58 | + | |
| 59 | + | |
76 | 60 | | |
77 | 61 | | |
78 | 62 | | |
79 | | - | |
| 63 | + | |
80 | 64 | | |
81 | 65 | | |
82 | 66 | | |
83 | 67 | | |
84 | 68 | | |
85 | | - | |
86 | | - | |
87 | 69 | | |
88 | 70 | | |
| 71 | + | |
| 72 | + | |
89 | 73 | | |
90 | 74 | | |
91 | | - | |
92 | 75 | | |
93 | 76 | | |
94 | 77 | | |
| |||
98 | 81 | | |
99 | 82 | | |
100 | 83 | | |
101 | | - | |
102 | | - | |
103 | 84 | | |
104 | 85 | | |
| 86 | + | |
| 87 | + | |
105 | 88 | | |
106 | 89 | | |
107 | 90 | | |
108 | 91 | | |
109 | 92 | | |
110 | 93 | | |
111 | 94 | | |
112 | | - | |
| 95 | + | |
113 | 96 | | |
114 | 97 | | |
115 | 98 | | |
116 | | - | |
| 99 | + | |
| 100 | + | |
117 | 101 | | |
118 | 102 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
136 | 128 | | |
137 | | - | |
138 | | - | |
139 | | - | |
| 129 | + | |
140 | 130 | | |
141 | 131 | | |
142 | 132 | | |
| |||
159 | 149 | | |
160 | 150 | | |
161 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
162 | 155 | | |
163 | 156 | | |
164 | 157 | | |
| |||
183 | 176 | | |
184 | 177 | | |
185 | 178 | | |
| 179 | + | |
186 | 180 | | |
187 | 181 | | |
188 | | - | |
| 182 | + | |
189 | 183 | | |
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
193 | 191 | | |
194 | 192 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
199 | 209 | | |
200 | | - | |
201 | | - | |
| 210 | + | |
| 211 | + | |
202 | 212 | | |
203 | 213 | | |
204 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
205 | 219 | | |
206 | 220 | | |
207 | 221 | | |
| |||
220 | 234 | | |
221 | 235 | | |
222 | 236 | | |
223 | | - | |
| 237 | + | |
224 | 238 | | |
225 | | - | |
| 239 | + | |
| 240 | + | |
226 | 241 | | |
227 | | - | |
| 242 | + | |
228 | 243 | | |
229 | 244 | | |
230 | 245 | | |
| |||
234 | 249 | | |
235 | 250 | | |
236 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
237 | 255 | | |
238 | 256 | | |
239 | 257 | | |
240 | 258 | | |
241 | 259 | | |
242 | | - | |
| 260 | + | |
243 | 261 | | |
244 | 262 | | |
245 | 263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 27 | + | |
35 | 28 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
41 | 33 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
50 | 46 | | |
51 | | - | |
52 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
53 | 83 | | |
54 | 84 | | |
55 | 85 | | |
| |||
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
75 | 110 | | |
76 | 111 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| |||
0 commit comments