@bprotsyk/aso-core 2.0.18 → 2.0.20

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.
@@ -9,6 +9,7 @@ const child_process_1 = __importDefault(require("child_process"));
9
9
  const ssh2_sftp_client_1 = __importDefault(require("ssh2-sftp-client"));
10
10
  const fs_1 = __importDefault(require("fs"));
11
11
  const mustache_1 = __importDefault(require("mustache"));
12
+ const path_1 = __importDefault(require("path"));
12
13
  const { promisify } = require("util");
13
14
  const execPromise = promisify(child_process_1.default.exec);
14
15
  exports.IP = "185.123.53.227";
@@ -180,7 +181,8 @@ class ServerUtil {
180
181
  }
181
182
  }
182
183
  async generateNginxConfig(domain, rootPath) {
183
- const template = fs_1.default.readFileSync("templates/nginx-template.conf", "utf8");
184
+ const templatePath = path_1.default.join(__dirname, 'templates', 'nginx-template.conf');
185
+ const template = fs_1.default.readFileSync(templatePath, "utf8");
184
186
  const config = mustache_1.default.render(template, { domain, rootPath });
185
187
  return config;
186
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -3,6 +3,7 @@ import ChildProcess from "child_process";
3
3
  import Client from "ssh2-sftp-client";
4
4
  import fs from "fs";
5
5
  import mustache from "mustache";
6
+ import path from "path";
6
7
  const { promisify } = require("util");
7
8
  const execPromise = promisify(ChildProcess.exec);
8
9
 
@@ -219,7 +220,8 @@ export class ServerUtil {
219
220
  }
220
221
 
221
222
  async generateNginxConfig(domain: string, rootPath: string): Promise<string> {
222
- const template = fs.readFileSync("templates/nginx-template.conf", "utf8");
223
+ const templatePath = path.join(__dirname, 'templates', 'nginx-template.conf');
224
+ const template = fs.readFileSync(templatePath, "utf8");
223
225
  const config = mustache.render(template, { domain, rootPath });
224
226
  return config;
225
227
  }