@neta-art/cohub-cli 1.6.1 → 1.6.2
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/dist/commands/spaces.js +4 -2
- package/package.json +1 -1
package/dist/commands/spaces.js
CHANGED
|
@@ -14,6 +14,8 @@ function requireSpace(program) {
|
|
|
14
14
|
}
|
|
15
15
|
return error("Missing required option", "Add -s, --space <id> to target a space");
|
|
16
16
|
}
|
|
17
|
+
const cliEnv = (process.env.ENV === "prod" ? "prod" : "dev");
|
|
18
|
+
const defaultIdleTtlSeconds = cliEnv === "prod" ? 12 * 60 * 60 : 10 * 60;
|
|
17
19
|
const parseAutoDestroy = (opts) => {
|
|
18
20
|
const mode = opts.autoDestroy ?? (opts.idleTtl ? "idle" : undefined);
|
|
19
21
|
if (!mode)
|
|
@@ -22,7 +24,7 @@ const parseAutoDestroy = (opts) => {
|
|
|
22
24
|
return { mode: "never" };
|
|
23
25
|
if (mode !== "idle")
|
|
24
26
|
return error("Invalid auto destroy mode", "Use --auto-destroy idle or --auto-destroy never");
|
|
25
|
-
const ttlSeconds = Number.parseInt(opts.idleTtl ??
|
|
27
|
+
const ttlSeconds = Number.parseInt(opts.idleTtl ?? String(defaultIdleTtlSeconds), 10);
|
|
26
28
|
if (!Number.isSafeInteger(ttlSeconds) || ttlSeconds < 60 || ttlSeconds > 30 * 24 * 60 * 60) {
|
|
27
29
|
return error("Invalid idle TTL", "--idle-ttl must be an integer between 60 and 2592000 seconds");
|
|
28
30
|
}
|
|
@@ -30,7 +32,7 @@ const parseAutoDestroy = (opts) => {
|
|
|
30
32
|
};
|
|
31
33
|
const formatAutoDestroy = (policy) => {
|
|
32
34
|
if (!policy)
|
|
33
|
-
return "
|
|
35
|
+
return `${cliEnv === "prod" ? "12h" : "10m"} (default)`;
|
|
34
36
|
if (policy.mode === "never")
|
|
35
37
|
return "never";
|
|
36
38
|
if (policy.ttlSeconds % 86400 === 0)
|