@sysnee/pgs 0.1.6 → 0.1.7-rc.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.
Files changed (2) hide show
  1. package/manager.js +11 -5
  2. package/package.json +1 -1
package/manager.js CHANGED
@@ -118,9 +118,9 @@ function updateHAProxyDependsOn() {
118
118
  container_name: 'postgres_proxy',
119
119
  ports: ['5432:5432'],
120
120
  volumes: [
121
- './haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro',
121
+ `${HAPROXY_CFG_PATH}:/usr/local/etc/haproxy/haproxy.cfg:ro`,
122
122
  './haproxy-lua:/etc/haproxy/lua:ro',
123
- './tenant-access.json:/etc/haproxy/tenant-access.json:ro'
123
+ `${TENANT_ACCESS_FILE_PATH}:/etc/haproxy/tenant-access.json:ro`
124
124
  ],
125
125
  networks: ['postgres_network'],
126
126
  restart: 'unless-stopped'
@@ -217,14 +217,20 @@ function createInitialFiles() {
217
217
  }
218
218
 
219
219
  // docker-compose.yml
220
- if (!fs.existsSync(COMPOSE_FILE_PATH)) {
220
+ if (!existsSync(COMPOSE_FILE_PATH)) {
221
221
  const dockerComposeInitialContent = readFileSync(path.join(__dirname, 'docker-compose.yml'), 'utf8')
222
222
  writeFileSync(COMPOSE_FILE_PATH, dockerComposeInitialContent)
223
223
  }
224
224
 
225
225
  // tenant-access.json
226
- if (!fs.existsSync(TENANT_ACCESS_FILE_PATH)) {
227
- fs.writeFileSync(TENANT_ACCESS_FILE_PATH, '{}');
226
+ if (!existsSync(TENANT_ACCESS_FILE_PATH)) {
227
+ writeFileSync(TENANT_ACCESS_FILE_PATH, '{}');
228
+ }
229
+
230
+ // haproxy.cfg
231
+ if (!existsSync(HAPROXY_CFG_PATH)) {
232
+ const haproxyTemplate = readFileSync(path.join(__dirname, 'haproxy.cfg'), 'utf8');
233
+ writeFileSync(HAPROXY_CFG_PATH, haproxyTemplate);
228
234
  }
229
235
  }
230
236
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sysnee/pgs",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-rc.1",
4
4
  "description": "Dynamic PostgreSQL service instance manager",
5
5
  "type": "module",
6
6
  "bin": {