@mixio-pro/kalaasetu-mcp 2.2.7-exp â 2.2.8-exp
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.
- package/package.json +1 -1
- package/src/utils/remote-config.ts +44 -37
package/package.json
CHANGED
|
@@ -32,45 +32,48 @@ export async function loadRemoteConfig() {
|
|
|
32
32
|
let clientId = process.env.CLIENT_ID?.trim();
|
|
33
33
|
let projectId = process.env.PROJECT_ID?.trim();
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
if (key === "PROJECT_ID") {
|
|
65
|
-
if (!projectId) projectId = value;
|
|
66
|
-
}
|
|
35
|
+
const cwd = process.env.VSCODE_CWD || process.cwd();
|
|
36
|
+
if (cwd) {
|
|
37
|
+
// Check .env.local first, then .env
|
|
38
|
+
const envLocalPath = join(cwd, ".env.local");
|
|
39
|
+
const envPath = join(cwd, ".env");
|
|
40
|
+
let targetPath = existsSync(envLocalPath)
|
|
41
|
+
? envLocalPath
|
|
42
|
+
: existsSync(envPath)
|
|
43
|
+
? envPath
|
|
44
|
+
: null;
|
|
45
|
+
|
|
46
|
+
if (targetPath) {
|
|
47
|
+
try {
|
|
48
|
+
const content = readFileSync(targetPath, "utf-8");
|
|
49
|
+
const lines = content.split(/\r?\n/);
|
|
50
|
+
|
|
51
|
+
for (const line of lines) {
|
|
52
|
+
const trimmedLine = line.trim();
|
|
53
|
+
if (!trimmedLine || trimmedLine.startsWith("#")) continue;
|
|
54
|
+
|
|
55
|
+
const match = trimmedLine.match(/^\s*([^=]+)\s*=\s*(.*)$/);
|
|
56
|
+
if (match && match[1] !== undefined && match[2] !== undefined) {
|
|
57
|
+
const key = match[1].trim();
|
|
58
|
+
const value = match[2].trim().replace(/^(['"])(.*)\1$/, "$2");
|
|
59
|
+
|
|
60
|
+
// Load into process.env if not already set manually in current execution
|
|
61
|
+
if (!process.env[key]) {
|
|
62
|
+
process.env[key] = value;
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
|
|
70
|
-
logger.info("đ Loaded environment details from .env.local");
|
|
71
|
-
} catch (err) {
|
|
72
|
-
logger.warn(`Failed to read .env.local in VSCODE_CWD: ${err}`);
|
|
73
65
|
}
|
|
66
|
+
|
|
67
|
+
// Re-evaluate variables after loading from file
|
|
68
|
+
token =
|
|
69
|
+
(process.env.MIXIO_TOKEN || process.env.MIXIO_CONFIG_JWT)?.trim() ||
|
|
70
|
+
token;
|
|
71
|
+
clientId = process.env.CLIENT_ID?.trim() || clientId;
|
|
72
|
+
projectId = process.env.PROJECT_ID?.trim() || projectId;
|
|
73
|
+
|
|
74
|
+
logger.info(`đ Loaded environment details from ${targetPath}`);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
logger.warn(`Failed to read env file: ${err}`);
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
}
|
|
@@ -94,10 +97,14 @@ export async function loadRemoteConfig() {
|
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
// Ensure CLIENT_ID and PROJECT_ID are
|
|
100
|
+
// Ensure CLIENT_ID and PROJECT_ID are forcefully populated into process.env if derived
|
|
98
101
|
if (clientId) process.env.CLIENT_ID = clientId;
|
|
99
102
|
if (projectId) process.env.PROJECT_ID = projectId;
|
|
100
103
|
|
|
104
|
+
logger.info(
|
|
105
|
+
`đ Config check: CLIENT_ID=${process.env.CLIENT_ID}, PROJECT_ID=${process.env.PROJECT_ID}`,
|
|
106
|
+
);
|
|
107
|
+
|
|
101
108
|
if (!token || !clientId || !projectId) {
|
|
102
109
|
logger.info(
|
|
103
110
|
`âšī¸ Remote config skipped: token=${!!token}, client=${clientId || "missing"}, project=${projectId || "missing"}. Continuing with local env.`,
|