@dooer/dooer-test-env 1.7.0 → 1.8.0
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/lib/engine/seed.js +30 -0
- package/package.json +1 -1
package/lib/engine/seed.js
CHANGED
|
@@ -133,7 +133,22 @@ Optional:
|
|
|
133
133
|
function sh(file, args) {
|
|
134
134
|
return execFileSync(file, args, { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 }).trim()
|
|
135
135
|
}
|
|
136
|
+
// The LOCAL test env is addressed as the pseudo-namespace `local`: the docker-compose Postgres published on
|
|
137
|
+
// 55432, and MinIO standing in for Ceph. Lets `customer copy --target-namespace local` pull a real org out
|
|
138
|
+
// of staging/production into the local stack. (Jimmy 2026-09-03.)
|
|
139
|
+
const LOCAL_NAMESPACE = 'local'
|
|
140
|
+
const isLocalNamespace = (namespace) => namespace === LOCAL_NAMESPACE
|
|
141
|
+
|
|
136
142
|
function connInfo(namespace) {
|
|
143
|
+
if (isLocalNamespace(namespace)) {
|
|
144
|
+
return {
|
|
145
|
+
host: 'localhost',
|
|
146
|
+
port: Number(process.env.DOOER_TEST_ENV_PG_PORT || 55432),
|
|
147
|
+
user: 'dooer',
|
|
148
|
+
password: 'dooer',
|
|
149
|
+
database: 'dooer',
|
|
150
|
+
}
|
|
151
|
+
}
|
|
137
152
|
const clusterIP = sh('kubectl', ['get', 'svc', 'dooer-database', '-n', namespace, '-o', 'jsonpath={.spec.clusterIP}'])
|
|
138
153
|
const b64 = sh('kubectl', [
|
|
139
154
|
'get',
|
|
@@ -236,6 +251,21 @@ async function withRetry(fn, { tries = 6, label = 'op' } = {}) {
|
|
|
236
251
|
// from the SOURCE env bucket to the TARGET env bucket at its NEW key (= the copied fileData id), so the
|
|
237
252
|
// copy owns its own files. Endpoint/bucket/credentials are read from the file-storage pod per namespace.
|
|
238
253
|
function s3Config(namespace) {
|
|
254
|
+
if (isLocalNamespace(namespace)) {
|
|
255
|
+
// local MinIO — the bucket `minio-init` provisions (see lib/compose/generate.js S3_BUCKETS).
|
|
256
|
+
return {
|
|
257
|
+
primary: {
|
|
258
|
+
bucket: 'file-storage-bucket',
|
|
259
|
+
client: new S3Client({
|
|
260
|
+
endpoint: process.env.DOOER_TEST_ENV_S3 || 'http://localhost:9000',
|
|
261
|
+
region: 'us-east-1',
|
|
262
|
+
forcePathStyle: true,
|
|
263
|
+
credentials: { accessKeyId: 'minioadmin', secretAccessKey: 'minioadmin' },
|
|
264
|
+
}),
|
|
265
|
+
},
|
|
266
|
+
fallback: null,
|
|
267
|
+
}
|
|
268
|
+
}
|
|
239
269
|
const pods = sh('kubectl', [
|
|
240
270
|
'get',
|
|
241
271
|
'pods',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dooer/dooer-test-env",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Run the whole Dooer backend locally (staging DB minus customers), copy/purge customers between environments, and shred — one CLI.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": "Dooer/cli-dooer-test-env",
|