@suronai/cli 0.1.14 → 0.1.16
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/index.js +1 -1
- package/src/utils/config.js +4 -1
- package/src/utils/dotenvx.js +5 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
package/src/utils/config.js
CHANGED
|
@@ -39,7 +39,10 @@ export function saveConfig(values) {
|
|
|
39
39
|
|
|
40
40
|
/** @returns {string | null} */
|
|
41
41
|
export function getApiUrl() {
|
|
42
|
-
|
|
42
|
+
// Strip trailing slash from both sources so callers always get a clean URL.
|
|
43
|
+
const fromEnv = process.env.SURON_API_URL?.replace(/\/$/, "");
|
|
44
|
+
const fromConfig = readConfig().apiUrl?.replace(/\/$/, "");
|
|
45
|
+
return fromEnv ?? fromConfig ?? null;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/** @returns {string} */
|
package/src/utils/dotenvx.js
CHANGED
|
@@ -13,12 +13,13 @@ export function encryptDotenv(cwd) {
|
|
|
13
13
|
if (!existsSync(join(cwd, ".env"))) {
|
|
14
14
|
throw new Error(`.env not found in ${cwd}`);
|
|
15
15
|
}
|
|
16
|
-
// Strip
|
|
17
|
-
// If dotenvx sees
|
|
18
|
-
// writing .env.keys, which
|
|
16
|
+
// Strip all dotenvx keypair vars from the child environment.
|
|
17
|
+
// If dotenvx sees DOTENV_PRIVATE_KEY *or* DOTENV_PUBLIC_KEY already set
|
|
18
|
+
// it reuses that keypair and skips writing .env.keys entirely, which
|
|
19
|
+
// breaks readPrivateKey() immediately after.
|
|
19
20
|
const env = { ...process.env };
|
|
20
21
|
for (const k of Object.keys(env)) {
|
|
21
|
-
if (k.startsWith("DOTENV_PRIVATE_KEY")) delete env[k];
|
|
22
|
+
if (k.startsWith("DOTENV_PRIVATE_KEY") || k.startsWith("DOTENV_PUBLIC_KEY")) delete env[k];
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
try {
|