@myvillage/cli 1.0.2 → 1.0.3
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/config.js +9 -3
package/package.json
CHANGED
package/src/utils/config.js
CHANGED
|
@@ -8,7 +8,7 @@ const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
|
|
|
8
8
|
const DEFAULT_CONFIG = {
|
|
9
9
|
apiBaseUrl: 'https://portal.myvillageproject.ai/api/v1',
|
|
10
10
|
oauthBaseUrl: 'https://portal.myvillageproject.ai/api/oauth',
|
|
11
|
-
clientId: '
|
|
11
|
+
clientId: 'mvos_aG_c729fuQxvvqYHOnkgTQ',
|
|
12
12
|
callbackPort: 3737,
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -21,14 +21,20 @@ function ensureConfigDir() {
|
|
|
21
21
|
export function getConfig() {
|
|
22
22
|
ensureConfigDir();
|
|
23
23
|
|
|
24
|
+
// Only persist user-overridable settings (not clientId/oauthBaseUrl which are app constants)
|
|
24
25
|
if (!existsSync(CONFIG_FILE)) {
|
|
25
|
-
|
|
26
|
+
const { clientId, oauthBaseUrl, ...persistable } = DEFAULT_CONFIG;
|
|
27
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(persistable, null, 2));
|
|
26
28
|
return { ...DEFAULT_CONFIG };
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
try {
|
|
30
32
|
const data = readFileSync(CONFIG_FILE, 'utf-8');
|
|
31
|
-
|
|
33
|
+
const fileConfig = JSON.parse(data);
|
|
34
|
+
// Remove stale clientId/oauthBaseUrl from file config — code defaults always win
|
|
35
|
+
delete fileConfig.clientId;
|
|
36
|
+
delete fileConfig.oauthBaseUrl;
|
|
37
|
+
return { ...DEFAULT_CONFIG, ...fileConfig };
|
|
32
38
|
} catch {
|
|
33
39
|
return { ...DEFAULT_CONFIG };
|
|
34
40
|
}
|