@xuda.io/drive_module 1.1.1195 → 1.1.1196
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.
- package/index.js +8 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -615,7 +615,14 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
615
615
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
616
616
|
ref = app_id_master;
|
|
617
617
|
|
|
618
|
-
|
|
618
|
+
const { data: app_obj } = await db_module.get_app_obj(app_id);
|
|
619
|
+
if (app_obj?.app_type === 'datacenter') {
|
|
620
|
+
//app_obj.is_deployment // not possible, every deployment will have is own upload mechanism
|
|
621
|
+
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
622
|
+
await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${file_name}; `);
|
|
623
|
+
} else {
|
|
624
|
+
doc.bucket[`${process.env.XUDA_HOSTNAME}`] = await upload_file_to_spaces(tempPath, app_id_master, drive_type, file_name);
|
|
625
|
+
}
|
|
619
626
|
|
|
620
627
|
save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
|
|
621
628
|
// misc_module.rsync_drive_resources_to_remote_servers('workspace', app_id_master);
|
|
@@ -1159,24 +1166,6 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1159
1166
|
doc.app_id = app_id;
|
|
1160
1167
|
doc.app_id_reference = ref;
|
|
1161
1168
|
|
|
1162
|
-
/// check existing file
|
|
1163
|
-
// if (check_exist) {
|
|
1164
|
-
// const workspace_drive_res = await db_module.find_app_couch_query(
|
|
1165
|
-
// app_id,
|
|
1166
|
-
// {
|
|
1167
|
-
// selector: { docType: "workspace_drive", originalname, stat: 3 },
|
|
1168
|
-
// limit: 99,
|
|
1169
|
-
// }
|
|
1170
|
-
// );
|
|
1171
|
-
// if (workspace_drive_res.docs.length) {
|
|
1172
|
-
// return {
|
|
1173
|
-
// code: -762,
|
|
1174
|
-
// data: "file already exist",
|
|
1175
|
-
// duplicates: workspace_drive_res.docs,
|
|
1176
|
-
// };
|
|
1177
|
-
// }
|
|
1178
|
-
// }
|
|
1179
|
-
debugger;
|
|
1180
1169
|
// if file uploaded from deployment or from datacenter then save to the datacenter server fs
|
|
1181
1170
|
const { data: app_obj } = await db_module.get_app_obj(app_id);
|
|
1182
1171
|
if (app_obj?.app_type === 'datacenter') {
|