@sysnee/pgs 0.1.4-rc1 → 0.1.4-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.
Files changed (2) hide show
  1. package/manager.js +11 -3
  2. package/package.json +1 -1
package/manager.js CHANGED
@@ -6,6 +6,14 @@ import yaml from 'js-yaml';
6
6
  import os from 'os';
7
7
  import { Command } from 'commander';
8
8
  import { execSync } from 'child_process';
9
+ import { fileURLToPath } from 'url';
10
+ import { dirname } from 'path';
11
+
12
+ import packageJson from './package.json' with { type: 'json' };
13
+
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
9
17
 
10
18
  const CONFIG_DIR = path.join(os.homedir(), '.sysnee-config');
11
19
 
@@ -70,10 +78,10 @@ function generateHAProxyConfig() {
70
78
  console.debug(`tenants.lenght: ${tenants.length}`)
71
79
 
72
80
  // Get initial HAProxy config
73
- const templateFilePath = path.join(path.dirname(''), 'haproxy.cfg')
81
+ const templateFilePath = path.join(__dirname, 'haproxy.cfg')
74
82
  console.debug(`haproxy template file path: ${templateFilePath}`)
75
83
  let config = readFileSync(templateFilePath, 'utf8');
76
- console.debug(`haproxy template file loaded: ${config}`)
84
+ console.debug(`haproxy template file loaded`)
77
85
 
78
86
  // Add all tenant backends to SSL pool for SSL negotiation
79
87
  // PostgreSQL will respond 'N' (no SSL) during negotiation, then client retries without SSL
@@ -392,7 +400,7 @@ const program = new Command();
392
400
  program
393
401
  .name('postgres-manager')
394
402
  .description('Manage PostgreSQL tenant instances')
395
- .version('0.1.4-rc1');
403
+ .version(packageJson.version);
396
404
 
397
405
  program
398
406
  .command('setup')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sysnee/pgs",
3
- "version": "0.1.4-rc1",
3
+ "version": "0.1.4-rc3",
4
4
  "description": "Dynamic PostgreSQL service instance manager",
5
5
  "type": "module",
6
6
  "bin": {