@zintrust/core 0.7.8 → 0.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ import { Env } from '@zintrust/core';
2
+ import type { TraceConfigOverrides } from '@zintrust/trace';
3
+
4
+ /**
5
+ * SystemTrace Configuration
6
+ *
7
+ * Keep this file declarative:
8
+ * - Package owns defaults and type validation.
9
+ * - Edit values below to override for this project.
10
+ *
11
+ * Usage: import '@zintrust/trace/register' in your bootstrap.
12
+ * Protect /trace with your own middleware (auth, admin role, etc.).
13
+ */
14
+
15
+ export default {
16
+ enabled: Env.getBool('TRACE_ENABLED', false),
17
+
18
+ // Optional: use a separate DB connection for trace tables.
19
+ // Leave undefined to fall back to the app's default connection.
20
+ connection: Env.get('TRACE_DB_CONNECTION', '') || undefined,
21
+
22
+ pruneAfterHours: Env.getInt('TRACE_PRUNE_HOURS', 72),
23
+
24
+ ignoreRoutes: ['/trace', '/health', '/ping', '/metrics', '/api-docs', '/api-docs-json'],
25
+
26
+ ignorePaths: [
27
+ '/telemetry',
28
+ '/favicon.ico',
29
+ '/robots.txt',
30
+ '/sitemap.xml',
31
+ '/workers',
32
+ '/queue-monitor',
33
+ '.js',
34
+ '.css',
35
+ ],
36
+
37
+ slowQueryThreshold: Env.getInt('TRACE_SLOW_QUERY_MS', 100),
38
+
39
+ logMinLevel: Env.get('TRACE_LOG_LEVEL', 'warn') as 'debug' | 'info' | 'warn' | 'error' | 'fatal',
40
+
41
+ watchers: {
42
+ // Set a watcher to false to disable it entirely.
43
+ // All watchers are enabled by default when trace is enabled.
44
+ // Include/exclude filters are contains-based and can be applied per watcher.
45
+ // request: {
46
+ // get: { exclude: ['report','workers/events'] },
47
+ // post: { include: ['auth'] },
48
+ // patch: { include: ['profile'] },
49
+ // delete: { exclude: ['internal'] },
50
+ // },
51
+ // log: { exclude: ['healthcheck'] },
52
+ // exception: { include: ['trace'] },
53
+ // clientRequest: {
54
+ // exclude: ['internal-http'],
55
+ // sources: {
56
+ // termii: { enabled: false },
57
+ // sendgrid: { responseBody: false },
58
+ // s3: { requestHeaders: false, responseHeaders: false },
59
+ // },
60
+ // },
61
+ // cache: { include: ['session:'] },
62
+ // dump: false, // DumpWatcher is opt-in — enable explicitly if needed
63
+ },
64
+
65
+ redaction: {
66
+ // Extra keys to mask recursively before trace entries are persisted.
67
+ // You can also provide these via TRACE_REDACT_KEYS as JSON or CSV.
68
+ keys: ['password', 'token', 'secret', 'authorization', 'card', 'cardNumber', 'cvv'],
69
+ headers: ['authorization', 'cookie', 'x-api-key', 'x-auth-token'],
70
+ body: ['password', 'token', 'secret', 'apiKey', 'api_key', 'jwt', 'bearer'],
71
+ query: [],
72
+ },
73
+ } satisfies TraceConfigOverrides;