@sysnee/pgs 0.1.7-rc.12 → 0.1.7-rc.14

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.
Files changed (2) hide show
  1. package/manager.js +7 -2
  2. package/package.json +1 -1
package/manager.js CHANGED
@@ -29,7 +29,6 @@ const SETUP_STATUS_PATH = path.join(CONFIG_DIR, 'status.txt');
29
29
 
30
30
  function loadCompose() {
31
31
  const content = fs.readFileSync(COMPOSE_FILE_PATH, 'utf8');
32
- console.debug(`docker-compose file readed from ${COMPOSE_FILE_PATH}`)
33
32
  return yaml.load(content);
34
33
  }
35
34
 
@@ -433,7 +432,13 @@ function createTenant(tenantId, options = {}) {
433
432
  const doc = loadCompose();
434
433
 
435
434
  if (doc.services && doc.services[`pgs_${tenantId}`]) {
436
- throw new Error(`Tenant ${tenantId} already exists`);
435
+ console.log(`Tenant ${tenantId} already exists; ensuring it's up`);
436
+ try {
437
+ executeCommand(`docker compose up -d pgs_${tenantId}`);
438
+ } catch (err) {
439
+ console.warn(`Warning: failed to ensure ${tenantId} is up: ${err.message}`);
440
+ }
441
+ return { tenantId, serviceName: `pgs_${tenantId}` };
437
442
  }
438
443
 
439
444
  if (!doc.services) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sysnee/pgs",
3
- "version": "0.1.7-rc.12",
3
+ "version": "0.1.7-rc.14",
4
4
  "description": "Dynamic PostgreSQL service instance manager",
5
5
  "type": "module",
6
6
  "bin": {