@bprotsyk/aso-core 2.0.23 → 2.0.25
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.
|
@@ -23,7 +23,7 @@ export declare class ServerUtil {
|
|
|
23
23
|
setupCertbot(): Promise<boolean>;
|
|
24
24
|
setupSSL(email: string, host: string): Promise<void>;
|
|
25
25
|
refresh(): Promise<boolean>;
|
|
26
|
-
deployLandingPage(host: string, username: string, password: string, remotePath: string, files: any): Promise<void>;
|
|
26
|
+
deployLandingPage(host: string, username: string, password: string, remotePath: string, port: 56777, files: any): Promise<void>;
|
|
27
27
|
generateNginxConfig(domain: string, rootPath: string): Promise<string>;
|
|
28
28
|
serverConect(IP: string): Promise<boolean>;
|
|
29
29
|
}
|
package/lib/utils/server-util.js
CHANGED
|
@@ -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";
|
|
@@ -165,11 +166,11 @@ class ServerUtil {
|
|
|
165
166
|
await this.exec(`git stash; rm-rf built; git pull`);
|
|
166
167
|
return true;
|
|
167
168
|
}
|
|
168
|
-
async deployLandingPage(host, username, password, remotePath, files) {
|
|
169
|
+
async deployLandingPage(host, username, password, remotePath, port, files) {
|
|
169
170
|
let sftp = new ssh2_sftp_client_1.default();
|
|
170
171
|
try {
|
|
171
172
|
//connection to the server via sftp
|
|
172
|
-
await sftp.connect({ host, username, password });
|
|
173
|
+
await sftp.connect({ host, username, password, port });
|
|
173
174
|
// Завантажити файли на сервер
|
|
174
175
|
for (const file of files) {
|
|
175
176
|
await sftp.put(Buffer.from(file.content, "base64"), `${remotePath}/${file.name}`);
|
|
@@ -180,7 +181,8 @@ class ServerUtil {
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
async generateNginxConfig(domain, rootPath) {
|
|
183
|
-
const
|
|
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
package/src/utils/server-util.ts
CHANGED
|
@@ -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
|
|
|
@@ -199,12 +200,13 @@ export class ServerUtil {
|
|
|
199
200
|
username: string,
|
|
200
201
|
password: string,
|
|
201
202
|
remotePath: string,
|
|
203
|
+
port: 56777,
|
|
202
204
|
files: any
|
|
203
205
|
): Promise<void> {
|
|
204
206
|
let sftp = new Client();
|
|
205
207
|
try {
|
|
206
208
|
//connection to the server via sftp
|
|
207
|
-
await sftp.connect({ host, username, password });
|
|
209
|
+
await sftp.connect({ host, username, password, port });
|
|
208
210
|
|
|
209
211
|
// Завантажити файли на сервер
|
|
210
212
|
for (const file of files) {
|
|
@@ -219,7 +221,8 @@ export class ServerUtil {
|
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
async generateNginxConfig(domain: string, rootPath: string): Promise<string> {
|
|
222
|
-
const
|
|
224
|
+
const templatePath = path.join(__dirname, '..', 'templates', 'nginx-template.conf');
|
|
225
|
+
const template = fs.readFileSync(templatePath, "utf8");
|
|
223
226
|
const config = mustache.render(template, { domain, rootPath });
|
|
224
227
|
return config;
|
|
225
228
|
}
|