@blogic-cz/agent-tools 0.4.0 → 0.4.1
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/db-tool/service.ts +10 -5
- package/src/db-tool/types.ts +1 -0
package/package.json
CHANGED
package/src/db-tool/service.ts
CHANGED
|
@@ -79,10 +79,11 @@ export class DbService extends ServiceMap.Service<
|
|
|
79
79
|
|
|
80
80
|
const envVars: Record<string, string> = {};
|
|
81
81
|
const regex = /^export\s+([A-Z_][A-Z0-9_]*)=["']?([^"'\n]+)["']?/gm;
|
|
82
|
-
let match
|
|
82
|
+
let match = regex.exec(content);
|
|
83
83
|
|
|
84
|
-
while (
|
|
84
|
+
while (match !== null) {
|
|
85
85
|
envVars[match[1]] = match[2];
|
|
86
|
+
match = regex.exec(content);
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
yield* Ref.set(zshrcEnvCache, envVars);
|
|
@@ -214,7 +215,7 @@ export class DbService extends ServiceMap.Service<
|
|
|
214
215
|
) => {
|
|
215
216
|
const args = [
|
|
216
217
|
"-h",
|
|
217
|
-
|
|
218
|
+
config.host,
|
|
218
219
|
"-p",
|
|
219
220
|
String(config.port),
|
|
220
221
|
"-U",
|
|
@@ -506,14 +507,18 @@ export class DbService extends ServiceMap.Service<
|
|
|
506
507
|
}
|
|
507
508
|
|
|
508
509
|
const isLocal = LOCALHOST_HOSTS.has(envConfig.host);
|
|
510
|
+
const isLocalEnvironment = env === "local";
|
|
511
|
+
const needsTunnel = dbConfig.kubectl !== undefined && !isLocalEnvironment && isLocal;
|
|
509
512
|
|
|
510
513
|
return {
|
|
514
|
+
host: envConfig.host,
|
|
511
515
|
user: envConfig.user,
|
|
512
516
|
database: envConfig.database,
|
|
517
|
+
password: envConfig.password,
|
|
513
518
|
passwordEnvVar: envConfig.passwordEnvVar,
|
|
514
519
|
port: envConfig.port,
|
|
515
|
-
needsTunnel
|
|
516
|
-
allowMutations:
|
|
520
|
+
needsTunnel,
|
|
521
|
+
allowMutations: isLocalEnvironment,
|
|
517
522
|
};
|
|
518
523
|
};
|
|
519
524
|
|