@kora-platform/cli 0.8.0-rc2 → 0.8.0-rc3
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/api-client.d.ts +0 -8
- package/dist/api-client.js +0 -9
- package/dist/command-registry.js +0 -10
- package/dist/commands.js +1 -20
- package/dist/files.d.ts +0 -4
- package/dist/files.js +12 -10
- package/dist/schema-registry-data.d.ts +71 -27
- package/dist/schema-registry-data.js +87 -36
- package/package.json +1 -1
- package/dist/dotenv.d.ts +0 -1
- package/dist/dotenv.js +0 -26
package/dist/api-client.d.ts
CHANGED
|
@@ -84,14 +84,6 @@ export declare function createPlatformApiClient(input: PlatformApiClientInput):
|
|
|
84
84
|
}): Promise<{
|
|
85
85
|
variables: RuntimeVariableRecord[];
|
|
86
86
|
}>;
|
|
87
|
-
importRuntimeVariables(session: CliSessionState, orgId: string, inputData: {
|
|
88
|
-
content: string;
|
|
89
|
-
environment: string;
|
|
90
|
-
fileName?: string | null;
|
|
91
|
-
}): Promise<{
|
|
92
|
-
importedCount: number;
|
|
93
|
-
variables: RuntimeVariableRecord[];
|
|
94
|
-
}>;
|
|
95
87
|
listOrgSecrets(session: CliSessionState, orgId: string, inputData?: {
|
|
96
88
|
environment?: string;
|
|
97
89
|
}): Promise<{
|
package/dist/api-client.js
CHANGED
|
@@ -96,15 +96,6 @@ export function createPlatformApiClient(input) {
|
|
|
96
96
|
session
|
|
97
97
|
});
|
|
98
98
|
},
|
|
99
|
-
async importRuntimeVariables(session, orgId, inputData) {
|
|
100
|
-
const { environment, ...body } = inputData;
|
|
101
|
-
return transport.requestJson({
|
|
102
|
-
body,
|
|
103
|
-
method: "POST",
|
|
104
|
-
path: withQuery(`/api/v1/orgs/${encodeURIComponent(orgId)}/runtime-variables/import`, { environment }),
|
|
105
|
-
session
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
99
|
async listOrgSecrets(session, orgId, inputData = {}) {
|
|
109
100
|
return transport.requestJson({
|
|
110
101
|
path: withQuery(`/api/v1/orgs/${encodeURIComponent(orgId)}/secrets`, inputData),
|
package/dist/command-registry.js
CHANGED
|
@@ -1119,16 +1119,6 @@ const RAW_CLI_COMMANDS = [
|
|
|
1119
1119
|
],
|
|
1120
1120
|
requiresActiveOrg: true
|
|
1121
1121
|
}),
|
|
1122
|
-
command(["env", "import"], "Import runtime variables from a .env file.", {
|
|
1123
|
-
labels: ["write", "env"],
|
|
1124
|
-
args: [arg("path-to-.env", "Path to a .env file.")],
|
|
1125
|
-
flags: [flag("environment", "Target environment.", {
|
|
1126
|
-
acceptsValue: true,
|
|
1127
|
-
required: true,
|
|
1128
|
-
valueType: "string"
|
|
1129
|
-
})],
|
|
1130
|
-
requiresActiveOrg: true
|
|
1131
|
-
}),
|
|
1132
1122
|
command(["secrets", "list"], "List organization secret names without values.", {
|
|
1133
1123
|
labels: ["read", "secret"],
|
|
1134
1124
|
flags: [flag("environment", "Target environment.", {
|
package/dist/commands.js
CHANGED
|
@@ -6,7 +6,7 @@ import { authProblem, genericProblem, notFoundProblem, usageProblem } from "./cl
|
|
|
6
6
|
import { readOptionalNumberFlag, readOptionalStringFlag, readRequiredStringFlag } from "./command-flags.js";
|
|
7
7
|
import { executeArtifactDownload, executeArtifactArchive, executeArtifactInspect, executeArtifactInventory, executeArtifactList, executeArtifactPurge, executeArtifactRead, executeArtifactRestore, executeArtifactUpload } from "./artifact-commands.js";
|
|
8
8
|
import { executeAudit } from "./audit-commands.js";
|
|
9
|
-
import { isZipArchivePath, readArchiveBytes, readImportEntries, readJsonInputSpecifier, readWorkspaceTestEntries, readTextInputSpecifier,
|
|
9
|
+
import { isZipArchivePath, readArchiveBytes, readImportEntries, readJsonInputSpecifier, readWorkspaceTestEntries, readTextInputSpecifier, writeReleaseSourceFiles } from "./files.js";
|
|
10
10
|
import { renderDiffSummary, renderKeyValue, renderPrettyJson, renderSuccess, renderTable } from "./format.js";
|
|
11
11
|
import { buildTaskDetailPresentation } from "./task-detail.js";
|
|
12
12
|
import { confirmDestructive } from "./interaction.js";
|
|
@@ -165,7 +165,6 @@ export async function executeParsedCommand(parsed, context) {
|
|
|
165
165
|
case "env.list":
|
|
166
166
|
case "env.get":
|
|
167
167
|
case "env.replace":
|
|
168
|
-
case "env.import":
|
|
169
168
|
return executeEnv(parsed, context, api);
|
|
170
169
|
case "secrets.list":
|
|
171
170
|
case "secrets.set":
|
|
@@ -1224,24 +1223,6 @@ async function executeEnv(parsed, context, api) {
|
|
|
1224
1223
|
meta: { command: parsed.definition.path.join(" "), environment, orgId: org.id }
|
|
1225
1224
|
};
|
|
1226
1225
|
}
|
|
1227
|
-
case "env.import": {
|
|
1228
|
-
const environment = readRequiredCliEnvironmentFlag(parsed);
|
|
1229
|
-
const filePath = readRequiredArg(parsed, "path-to-.env");
|
|
1230
|
-
const content = await readTextInputSpecifier(`@${filePath}`, context.stdin, parsed.definition.id);
|
|
1231
|
-
const preview = await parseEnvFile(filePath);
|
|
1232
|
-
announceResolvedEnvironment(parsed, context, environment);
|
|
1233
|
-
const data = await api.importRuntimeVariables(session, org.id, {
|
|
1234
|
-
content,
|
|
1235
|
-
environment,
|
|
1236
|
-
fileName: filePath
|
|
1237
|
-
});
|
|
1238
|
-
return {
|
|
1239
|
-
data,
|
|
1240
|
-
human: renderSuccess(`Imported ${data.importedCount} variables from ${filePath} into ${environment}. Parsed ${preview.length}.`),
|
|
1241
|
-
kind: "authoring_env_import",
|
|
1242
|
-
meta: { command: parsed.definition.path.join(" "), environment, orgId: org.id }
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
1226
|
default:
|
|
1246
1227
|
throw genericProblem(`Unhandled env command ${parsed.definition.id}.`, parsed.definition.id);
|
|
1247
1228
|
}
|
package/dist/files.d.ts
CHANGED
package/dist/files.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Buffer } from "node:buffer";
|
|
|
2
2
|
import { lstat, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
4
|
import { usageProblem } from "./cli-errors.js";
|
|
5
|
-
import { parseDotEnv } from "./dotenv.js";
|
|
6
5
|
import { shouldIgnoreWorkspacePath } from "./workspace-source.js";
|
|
7
6
|
const MAX_IMPORT_FILE_COUNT = 500;
|
|
8
7
|
const MAX_IMPORT_FILE_BYTES = 1_000_000;
|
|
@@ -56,7 +55,11 @@ async function readUtf8Entries(pathValue, options) {
|
|
|
56
55
|
throw usageProblem("Import path must be a regular file or directory, not a symbolic link.", options.instance);
|
|
57
56
|
}
|
|
58
57
|
if (pathStat.isFile()) {
|
|
59
|
-
const
|
|
58
|
+
const pathName = basename(absolutePath);
|
|
59
|
+
if (shouldIgnoreSourceImportPath(pathName)) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
const content = await readLimitedUtf8File(absolutePath, pathName, {
|
|
60
63
|
fileCount: 0,
|
|
61
64
|
totalBytes: 0
|
|
62
65
|
}, options);
|
|
@@ -170,13 +173,6 @@ export async function readPackageFileEntries(pathValue, instance) {
|
|
|
170
173
|
entries.sort((left, right) => left.path.localeCompare(right.path));
|
|
171
174
|
return entries;
|
|
172
175
|
}
|
|
173
|
-
export async function parseEnvFile(pathValue) {
|
|
174
|
-
const content = await readFile(pathValue, "utf8");
|
|
175
|
-
return Object.entries(parseDotEnv(content)).map(([name, value]) => ({
|
|
176
|
-
name,
|
|
177
|
-
value
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
176
|
function readJsonObject(source, instance) {
|
|
181
177
|
let parsed;
|
|
182
178
|
try {
|
|
@@ -203,7 +199,7 @@ async function walkImportDirectory(root, current, entries, counters, options) {
|
|
|
203
199
|
for (const child of children) {
|
|
204
200
|
const childPath = join(current, child.name);
|
|
205
201
|
const relativePath = relative(root, childPath).replaceAll("\\", "/");
|
|
206
|
-
if (
|
|
202
|
+
if (shouldIgnoreSourceImportPath(relativePath)) {
|
|
207
203
|
continue;
|
|
208
204
|
}
|
|
209
205
|
if (child.isDirectory()) {
|
|
@@ -247,6 +243,12 @@ async function walkPackageDirectory(root, current, entries, counters, instance)
|
|
|
247
243
|
function shouldIgnoreImportPath(pathValue) {
|
|
248
244
|
return shouldIgnoreWorkspacePath(pathValue);
|
|
249
245
|
}
|
|
246
|
+
function shouldIgnoreSourceImportPath(pathValue) {
|
|
247
|
+
return shouldIgnoreImportPath(pathValue) || isRemovedRuntimeEnvironmentPath(pathValue);
|
|
248
|
+
}
|
|
249
|
+
function isRemovedRuntimeEnvironmentPath(pathValue) {
|
|
250
|
+
return pathValue === ".env" || pathValue === ".env.example";
|
|
251
|
+
}
|
|
250
252
|
async function assertExportOutputIsEmpty(absolutePath, instance, outputLabel = "Export") {
|
|
251
253
|
try {
|
|
252
254
|
const pathStat = await lstat(absolutePath);
|
|
@@ -2943,14 +2943,6 @@ export declare const CLI_SCHEMA_REGISTRY_DATA: readonly [{
|
|
|
2943
2943
|
readonly maxLength: 4096;
|
|
2944
2944
|
readonly type: "string";
|
|
2945
2945
|
};
|
|
2946
|
-
readonly env: {
|
|
2947
|
-
readonly type: "object";
|
|
2948
|
-
readonly patternProperties: {
|
|
2949
|
-
readonly "^(.*)$": {
|
|
2950
|
-
readonly type: "string";
|
|
2951
|
-
};
|
|
2952
|
-
};
|
|
2953
|
-
};
|
|
2954
2946
|
readonly parseStdoutAsJson: {
|
|
2955
2947
|
readonly type: "boolean";
|
|
2956
2948
|
};
|
|
@@ -2964,39 +2956,91 @@ export declare const CLI_SCHEMA_REGISTRY_DATA: readonly [{
|
|
|
2964
2956
|
};
|
|
2965
2957
|
};
|
|
2966
2958
|
};
|
|
2967
|
-
readonly
|
|
2968
|
-
readonly additionalProperties:
|
|
2969
|
-
readonly type: "object";
|
|
2970
|
-
readonly properties: {};
|
|
2971
|
-
};
|
|
2972
|
-
readonly credentials: {
|
|
2959
|
+
readonly bindings: {
|
|
2960
|
+
readonly additionalProperties: false;
|
|
2973
2961
|
readonly type: "object";
|
|
2974
|
-
readonly
|
|
2975
|
-
readonly
|
|
2976
|
-
readonly
|
|
2977
|
-
readonly
|
|
2978
|
-
|
|
2979
|
-
readonly properties: {
|
|
2980
|
-
readonly bindingKind: {
|
|
2962
|
+
readonly properties: {
|
|
2963
|
+
readonly env: {
|
|
2964
|
+
readonly type: "array";
|
|
2965
|
+
readonly items: {
|
|
2966
|
+
readonly anyOf: readonly [{
|
|
2981
2967
|
readonly minLength: 1;
|
|
2982
2968
|
readonly maxLength: 128;
|
|
2969
|
+
readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
|
|
2983
2970
|
readonly type: "string";
|
|
2984
|
-
}
|
|
2985
|
-
|
|
2971
|
+
}, {
|
|
2972
|
+
readonly additionalProperties: false;
|
|
2973
|
+
readonly type: "object";
|
|
2974
|
+
readonly required: readonly ["name"];
|
|
2975
|
+
readonly properties: {
|
|
2976
|
+
readonly name: {
|
|
2977
|
+
readonly minLength: 1;
|
|
2978
|
+
readonly maxLength: 128;
|
|
2979
|
+
readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
|
|
2980
|
+
readonly type: "string";
|
|
2981
|
+
};
|
|
2982
|
+
readonly as: {
|
|
2983
|
+
readonly minLength: 1;
|
|
2984
|
+
readonly maxLength: 128;
|
|
2985
|
+
readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
|
|
2986
|
+
readonly type: "string";
|
|
2987
|
+
};
|
|
2988
|
+
};
|
|
2989
|
+
}];
|
|
2990
|
+
};
|
|
2991
|
+
};
|
|
2992
|
+
readonly secrets: {
|
|
2993
|
+
readonly type: "array";
|
|
2994
|
+
readonly items: {
|
|
2995
|
+
readonly anyOf: readonly [{
|
|
2986
2996
|
readonly minLength: 1;
|
|
2987
2997
|
readonly maxLength: 128;
|
|
2998
|
+
readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
|
|
2988
2999
|
readonly type: "string";
|
|
2989
|
-
}
|
|
2990
|
-
readonly inject: {
|
|
3000
|
+
}, {
|
|
2991
3001
|
readonly additionalProperties: false;
|
|
2992
3002
|
readonly type: "object";
|
|
2993
|
-
readonly required: readonly ["
|
|
3003
|
+
readonly required: readonly ["name"];
|
|
2994
3004
|
readonly properties: {
|
|
2995
|
-
readonly
|
|
3005
|
+
readonly name: {
|
|
2996
3006
|
readonly minLength: 1;
|
|
2997
3007
|
readonly maxLength: 128;
|
|
3008
|
+
readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
|
|
2998
3009
|
readonly type: "string";
|
|
2999
3010
|
};
|
|
3011
|
+
readonly as: {
|
|
3012
|
+
readonly minLength: 1;
|
|
3013
|
+
readonly maxLength: 128;
|
|
3014
|
+
readonly pattern: "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$";
|
|
3015
|
+
readonly type: "string";
|
|
3016
|
+
};
|
|
3017
|
+
};
|
|
3018
|
+
}];
|
|
3019
|
+
};
|
|
3020
|
+
};
|
|
3021
|
+
readonly extensions: {
|
|
3022
|
+
readonly type: "object";
|
|
3023
|
+
readonly patternProperties: {
|
|
3024
|
+
readonly "^(.*)$": {
|
|
3025
|
+
readonly additionalProperties: false;
|
|
3026
|
+
readonly type: "object";
|
|
3027
|
+
readonly required: readonly ["install", "functions"];
|
|
3028
|
+
readonly properties: {
|
|
3029
|
+
readonly install: {
|
|
3030
|
+
readonly minLength: 1;
|
|
3031
|
+
readonly maxLength: 128;
|
|
3032
|
+
readonly type: "string";
|
|
3033
|
+
};
|
|
3034
|
+
readonly functions: {
|
|
3035
|
+
readonly minItems: 1;
|
|
3036
|
+
readonly uniqueItems: true;
|
|
3037
|
+
readonly type: "array";
|
|
3038
|
+
readonly items: {
|
|
3039
|
+
readonly minLength: 1;
|
|
3040
|
+
readonly maxLength: 128;
|
|
3041
|
+
readonly type: "string";
|
|
3042
|
+
};
|
|
3043
|
+
};
|
|
3000
3044
|
};
|
|
3001
3045
|
};
|
|
3002
3046
|
};
|
|
@@ -3486,14 +3486,6 @@ export const CLI_SCHEMA_REGISTRY_DATA = [
|
|
|
3486
3486
|
"maxLength": 4096,
|
|
3487
3487
|
"type": "string"
|
|
3488
3488
|
},
|
|
3489
|
-
"env": {
|
|
3490
|
-
"type": "object",
|
|
3491
|
-
"patternProperties": {
|
|
3492
|
-
"^(.*)$": {
|
|
3493
|
-
"type": "string"
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
},
|
|
3497
3489
|
"parseStdoutAsJson": {
|
|
3498
3490
|
"type": "boolean"
|
|
3499
3491
|
},
|
|
@@ -3507,44 +3499,103 @@ export const CLI_SCHEMA_REGISTRY_DATA = [
|
|
|
3507
3499
|
}
|
|
3508
3500
|
}
|
|
3509
3501
|
},
|
|
3510
|
-
"
|
|
3511
|
-
"additionalProperties":
|
|
3512
|
-
"type": "object",
|
|
3513
|
-
"properties": {}
|
|
3514
|
-
},
|
|
3515
|
-
"credentials": {
|
|
3502
|
+
"bindings": {
|
|
3503
|
+
"additionalProperties": false,
|
|
3516
3504
|
"type": "object",
|
|
3517
|
-
"
|
|
3518
|
-
"
|
|
3519
|
-
"
|
|
3505
|
+
"properties": {
|
|
3506
|
+
"env": {
|
|
3507
|
+
"type": "array",
|
|
3508
|
+
"items": {
|
|
3509
|
+
"anyOf": [
|
|
3510
|
+
{
|
|
3511
|
+
"minLength": 1,
|
|
3512
|
+
"maxLength": 128,
|
|
3513
|
+
"pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
|
|
3514
|
+
"type": "string"
|
|
3515
|
+
},
|
|
3516
|
+
{
|
|
3517
|
+
"additionalProperties": false,
|
|
3518
|
+
"type": "object",
|
|
3519
|
+
"required": [
|
|
3520
|
+
"name"
|
|
3521
|
+
],
|
|
3522
|
+
"properties": {
|
|
3523
|
+
"name": {
|
|
3524
|
+
"minLength": 1,
|
|
3525
|
+
"maxLength": 128,
|
|
3526
|
+
"pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
|
|
3527
|
+
"type": "string"
|
|
3528
|
+
},
|
|
3529
|
+
"as": {
|
|
3530
|
+
"minLength": 1,
|
|
3531
|
+
"maxLength": 128,
|
|
3532
|
+
"pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
|
|
3533
|
+
"type": "string"
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
]
|
|
3538
|
+
}
|
|
3539
|
+
},
|
|
3540
|
+
"secrets": {
|
|
3541
|
+
"type": "array",
|
|
3542
|
+
"items": {
|
|
3543
|
+
"anyOf": [
|
|
3544
|
+
{
|
|
3545
|
+
"minLength": 1,
|
|
3546
|
+
"maxLength": 128,
|
|
3547
|
+
"pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
|
|
3548
|
+
"type": "string"
|
|
3549
|
+
},
|
|
3550
|
+
{
|
|
3551
|
+
"additionalProperties": false,
|
|
3552
|
+
"type": "object",
|
|
3553
|
+
"required": [
|
|
3554
|
+
"name"
|
|
3555
|
+
],
|
|
3556
|
+
"properties": {
|
|
3557
|
+
"name": {
|
|
3558
|
+
"minLength": 1,
|
|
3559
|
+
"maxLength": 128,
|
|
3560
|
+
"pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
|
|
3561
|
+
"type": "string"
|
|
3562
|
+
},
|
|
3563
|
+
"as": {
|
|
3564
|
+
"minLength": 1,
|
|
3565
|
+
"maxLength": 128,
|
|
3566
|
+
"pattern": "^(?!KORA_)[A-Za-z_][A-Za-z0-9_]*$",
|
|
3567
|
+
"type": "string"
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
]
|
|
3572
|
+
}
|
|
3573
|
+
},
|
|
3574
|
+
"extensions": {
|
|
3520
3575
|
"type": "object",
|
|
3521
|
-
"
|
|
3522
|
-
"
|
|
3523
|
-
"connectionRef",
|
|
3524
|
-
"inject"
|
|
3525
|
-
],
|
|
3526
|
-
"properties": {
|
|
3527
|
-
"bindingKind": {
|
|
3528
|
-
"minLength": 1,
|
|
3529
|
-
"maxLength": 128,
|
|
3530
|
-
"type": "string"
|
|
3531
|
-
},
|
|
3532
|
-
"connectionRef": {
|
|
3533
|
-
"minLength": 1,
|
|
3534
|
-
"maxLength": 128,
|
|
3535
|
-
"type": "string"
|
|
3536
|
-
},
|
|
3537
|
-
"inject": {
|
|
3576
|
+
"patternProperties": {
|
|
3577
|
+
"^(.*)$": {
|
|
3538
3578
|
"additionalProperties": false,
|
|
3539
3579
|
"type": "object",
|
|
3540
3580
|
"required": [
|
|
3541
|
-
"
|
|
3581
|
+
"install",
|
|
3582
|
+
"functions"
|
|
3542
3583
|
],
|
|
3543
3584
|
"properties": {
|
|
3544
|
-
"
|
|
3585
|
+
"install": {
|
|
3545
3586
|
"minLength": 1,
|
|
3546
3587
|
"maxLength": 128,
|
|
3547
3588
|
"type": "string"
|
|
3589
|
+
},
|
|
3590
|
+
"functions": {
|
|
3591
|
+
"minItems": 1,
|
|
3592
|
+
"uniqueItems": true,
|
|
3593
|
+
"type": "array",
|
|
3594
|
+
"items": {
|
|
3595
|
+
"minLength": 1,
|
|
3596
|
+
"maxLength": 128,
|
|
3597
|
+
"type": "string"
|
|
3598
|
+
}
|
|
3548
3599
|
}
|
|
3549
3600
|
}
|
|
3550
3601
|
}
|
package/package.json
CHANGED
package/dist/dotenv.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function parseDotEnv(source: string): Record<string, string>;
|
package/dist/dotenv.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/u;
|
|
2
|
-
export function parseDotEnv(source) {
|
|
3
|
-
const parsed = {};
|
|
4
|
-
const lines = source.split(/\r?\n/u);
|
|
5
|
-
for (const rawLine of lines) {
|
|
6
|
-
const line = rawLine.trim();
|
|
7
|
-
if (line.length === 0 || line.startsWith("#")) {
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
const separatorIndex = line.indexOf("=");
|
|
11
|
-
if (separatorIndex <= 0) {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
const rawName = line.slice(0, separatorIndex).trim();
|
|
15
|
-
if (!ENV_NAME_PATTERN.test(rawName)) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
let value = line.slice(separatorIndex + 1).trim();
|
|
19
|
-
if ((value.startsWith("\"") && value.endsWith("\"")) ||
|
|
20
|
-
(value.startsWith("'") && value.endsWith("'"))) {
|
|
21
|
-
value = value.slice(1, -1);
|
|
22
|
-
}
|
|
23
|
-
parsed[rawName] = value;
|
|
24
|
-
}
|
|
25
|
-
return parsed;
|
|
26
|
-
}
|