@bprotsyk/aso-core 2.0.25 → 2.0.27
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, port:
|
|
26
|
+
deployLandingPage(host: string, username: string, password: string, remotePath: string, port: number, 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
|
@@ -169,11 +169,14 @@ class ServerUtil {
|
|
|
169
169
|
async deployLandingPage(host, username, password, remotePath, port, files) {
|
|
170
170
|
let sftp = new ssh2_sftp_client_1.default();
|
|
171
171
|
try {
|
|
172
|
-
//connection to the server via sftp
|
|
173
172
|
await sftp.connect({ host, username, password, port });
|
|
174
|
-
|
|
173
|
+
const dirExists = await sftp.exists(remotePath);
|
|
174
|
+
if (!dirExists) {
|
|
175
|
+
await sftp.mkdir(remotePath, true);
|
|
176
|
+
}
|
|
175
177
|
for (const file of files) {
|
|
176
|
-
|
|
178
|
+
const remoteFilePath = `${remotePath}/${file.name}`;
|
|
179
|
+
await sftp.put(Buffer.from(file.content, "base64"), remoteFilePath);
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
finally {
|
package/package.json
CHANGED
package/src/utils/server-util.ts
CHANGED
|
@@ -200,25 +200,27 @@ export class ServerUtil {
|
|
|
200
200
|
username: string,
|
|
201
201
|
password: string,
|
|
202
202
|
remotePath: string,
|
|
203
|
-
port:
|
|
203
|
+
port: number,
|
|
204
204
|
files: any
|
|
205
205
|
): Promise<void> {
|
|
206
206
|
let sftp = new Client();
|
|
207
207
|
try {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
208
|
+
await sftp.connect({ host, username, password, port });
|
|
209
|
+
|
|
210
|
+
const dirExists = await sftp.exists(remotePath);
|
|
211
|
+
if (!dirExists) {
|
|
212
|
+
await sftp.mkdir(remotePath, true);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
for (const file of files) {
|
|
216
|
+
const remoteFilePath = `${remotePath}/${file.name}`;
|
|
217
|
+
await sftp.put(Buffer.from(file.content, "base64"), remoteFilePath);
|
|
218
|
+
}
|
|
218
219
|
} finally {
|
|
219
|
-
|
|
220
|
+
sftp.end();
|
|
220
221
|
}
|
|
221
222
|
}
|
|
223
|
+
|
|
222
224
|
|
|
223
225
|
async generateNginxConfig(domain: string, rootPath: string): Promise<string> {
|
|
224
226
|
const templatePath = path.join(__dirname, '..', 'templates', 'nginx-template.conf');
|