log-llm-config 1.3.60 → 1.3.62
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.
|
@@ -6,40 +6,13 @@
|
|
|
6
6
|
* Path templates are fetched from the backend (GET api/file-path-registry/sensitive-paths-audit-candidates/).
|
|
7
7
|
* The audit is sent with the rest of the config files in log_config_files (same auth, same batch).
|
|
8
8
|
*/
|
|
9
|
-
import { existsSync, writeFileSync, mkdirSync
|
|
9
|
+
import { existsSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { homedir } from 'node:os';
|
|
12
12
|
import { getSensitivePathsAuditCandidates } from './endpoint_client/index.js';
|
|
13
13
|
import { OPT_AI_SEC_MANAGEMENT_REL } from './bootstrap_constants.js';
|
|
14
|
+
import { loadEndpointBase } from './log_config_files/sender/endpoint_config.js';
|
|
14
15
|
const AUDIT_FILENAME = 'sensitive_paths_audit.txt';
|
|
15
|
-
function loadEndpointBase() {
|
|
16
|
-
if (process.env.OPTIMUS_ENDPOINT) {
|
|
17
|
-
return process.env.OPTIMUS_ENDPOINT.replace(/\/+$/, '') + '/';
|
|
18
|
-
}
|
|
19
|
-
const defaultEndpoint = 'https://app.optimuslabs.io/';
|
|
20
|
-
const envPath = join(process.cwd(), 'optimus_dev.env');
|
|
21
|
-
try {
|
|
22
|
-
if (!existsSync(envPath))
|
|
23
|
-
return defaultEndpoint;
|
|
24
|
-
const content = readFileSync(envPath, 'utf8');
|
|
25
|
-
for (const line of content.split(/\r?\n/)) {
|
|
26
|
-
const trimmed = line.trim();
|
|
27
|
-
if (!trimmed || trimmed.startsWith('#'))
|
|
28
|
-
continue;
|
|
29
|
-
const [key, ...rest] = trimmed.split('=');
|
|
30
|
-
if (key === 'OPTIMUS_ENDPOINT') {
|
|
31
|
-
const value = rest.join('=').trim();
|
|
32
|
-
if (value)
|
|
33
|
-
return value.replace(/\/+$/, '') + '/';
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// ignore
|
|
40
|
-
}
|
|
41
|
-
return defaultEndpoint;
|
|
42
|
-
}
|
|
43
16
|
function expandPath(template, cwd) {
|
|
44
17
|
if (template.startsWith('~/')) {
|
|
45
18
|
return join(homedir(), template.slice(2));
|