clean up
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
WRENCHJOB_PORT=3000
|
||||
WRENCHJOB_POSTGRE_URL='postgresql://wrenchboard:wrenchboard@10.20.30.60:5432/wrenchboard'
|
||||
COMMON_MEDIA_PATH='/opt/wrenchboard/TEST/COMMON/MEDIA/'
|
||||
COMMON_TASKFILE_PATH='/opt/wrenchboard/TEST/TASKFILE'
|
||||
COMMON_TASKF_PATH='/opt/wrenchboard/TEST/TASKFILE'
|
||||
@@ -5,35 +5,35 @@ const app = express()
|
||||
const cors = require("cors");
|
||||
const multer = require('multer')
|
||||
|
||||
const videoFileMap2={
|
||||
'cdn':'videos/v1.mp4',
|
||||
'generate-pass':'videos/v2.mp4',
|
||||
'get-post':'videos/v3.mp4',
|
||||
'tt1':'/opt/wrenchboard/TEST/COMMON/MEDIA/What Is Single Sign-on (SSO)? How It Works-(1080p25).mp4',
|
||||
'tt2':'/opt/wrenchboard/TEST/COMMON/MEDIA/What is RabbitMQ?-(1080p30).mp4',
|
||||
'tt3':'/opt/wrenchboard/TEST/COMMON/MEDIA/What is CORS?-(1080p50).mp4',
|
||||
'tt4':'/opt/wrenchboard/TEST/COMMON/MEDIA/SAML vs OAuth vs OIDC (explained simply!)-(1080p25).mp4',
|
||||
'tt5':'/opt/wrenchboard/TEST/COMMON/MEDIA/Running RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
'tt6':'/opt/wrenchboard/TEST/COMMON/MEDIA/React Proxy | Easiest Fix to CORS Errors-(2160p24).mp4',
|
||||
'tt7':'/opt/wrenchboard/TEST/COMMON/MEDIA/RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS-(686p30).mp4',
|
||||
'tt8':'/opt/wrenchboard/TEST/COMMON/MEDIA/RabbitMQ - RPC with NodeJs (request-reply pattern)-(1080p60).mp4',
|
||||
'tt9':'/opt/wrenchboard/TEST/COMMON/MEDIA/How to Install RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
}
|
||||
// const videoFileMap2={
|
||||
// 'cdn':'videos/v1.mp4',
|
||||
// 'generate-pass':'videos/v2.mp4',
|
||||
// 'get-post':'videos/v3.mp4',
|
||||
// 'tt1':'/opt/wrenchboard/TEST/COMMON/MEDIA/What Is Single Sign-on (SSO)? How It Works-(1080p25).mp4',
|
||||
// 'tt2':'/opt/wrenchboard/TEST/COMMON/MEDIA/What is RabbitMQ?-(1080p30).mp4',
|
||||
// 'tt3':'/opt/wrenchboard/TEST/COMMON/MEDIA/What is CORS?-(1080p50).mp4',
|
||||
// 'tt4':'/opt/wrenchboard/TEST/COMMON/MEDIA/SAML vs OAuth vs OIDC (explained simply!)-(1080p25).mp4',
|
||||
// 'tt5':'/opt/wrenchboard/TEST/COMMON/MEDIA/Running RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
// 'tt6':'/opt/wrenchboard/TEST/COMMON/MEDIA/React Proxy | Easiest Fix to CORS Errors-(2160p24).mp4',
|
||||
// 'tt7':'/opt/wrenchboard/TEST/COMMON/MEDIA/RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS-(686p30).mp4',
|
||||
// 'tt8':'/opt/wrenchboard/TEST/COMMON/MEDIA/RabbitMQ - RPC with NodeJs (request-reply pattern)-(1080p60).mp4',
|
||||
// 'tt9':'/opt/wrenchboard/TEST/COMMON/MEDIA/How to Install RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
// }
|
||||
|
||||
const videoFileMap={
|
||||
'cdn':'videos/v1.mp4',
|
||||
'generate-pass':'videos/v2.mp4',
|
||||
'get-post':'videos/v3.mp4',
|
||||
'tt1':'What Is Single Sign-on (SSO)? How It Works-(1080p25).mp4',
|
||||
'tt2':'What is RabbitMQ?-(1080p30).mp4',
|
||||
'tt3':'What is CORS?-(1080p50).mp4',
|
||||
'tt4':'SAML vs OAuth vs OIDC (explained simply!)-(1080p25).mp4',
|
||||
'tt5':'Running RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
'tt6':'React Proxy | Easiest Fix to CORS Errors-(2160p24).mp4',
|
||||
'tt7':'RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS-(686p30).mp4',
|
||||
'tt8':'RabbitMQ - RPC with NodeJs (request-reply pattern)-(1080p60).mp4',
|
||||
'tt9':'How to Install RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
}
|
||||
// const videoFileMap={
|
||||
// 'cdn':'videos/v1.mp4',
|
||||
// 'generate-pass':'videos/v2.mp4',
|
||||
// 'get-post':'videos/v3.mp4',
|
||||
// 'tt1':'What Is Single Sign-on (SSO)? How It Works-(1080p25).mp4',
|
||||
// 'tt2':'What is RabbitMQ?-(1080p30).mp4',
|
||||
// 'tt3':'What is CORS?-(1080p50).mp4',
|
||||
// 'tt4':'SAML vs OAuth vs OIDC (explained simply!)-(1080p25).mp4',
|
||||
// 'tt5':'Running RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
// 'tt6':'React Proxy | Easiest Fix to CORS Errors-(2160p24).mp4',
|
||||
// 'tt7':'RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS-(686p30).mp4',
|
||||
// 'tt8':'RabbitMQ - RPC with NodeJs (request-reply pattern)-(1080p60).mp4',
|
||||
// 'tt9':'How to Install RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
// }
|
||||
|
||||
console.log("Finding File");
|
||||
|
||||
@@ -47,26 +47,6 @@ app.use(cors(corsOptions));
|
||||
|
||||
const storage = multer.diskStorage({
|
||||
destination: function(req, file, cb) {
|
||||
/*
|
||||
let uid = req.body.uid;
|
||||
let job_uid = req.body.job_uid;
|
||||
console.log(" req.body -> ", req.body)
|
||||
console.log(" req.body.job_uid -> ", job_uid)
|
||||
|
||||
const fs = require('fs');
|
||||
const dir = process.env.COMMON_TASKFILE_PATH + "/DUMMY/" + uid;
|
||||
if (!fs.existsSync(dir)){
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
|
||||
const dir2 = process.env.COMMON_TASKFILE_PATH + "/DUMMY/" + uid+"/"+job_uid;
|
||||
if (!fs.existsSync(dir2)){
|
||||
fs.mkdirSync(dir2);
|
||||
}
|
||||
return cb(null, dir2)
|
||||
/opt/wrenchboard/TEST/DUMMY
|
||||
process.env.COMMON_TASKFILE_PATH +"/DUMMY"
|
||||
*/
|
||||
return cb(null, '/opt/wrenchboard/TEST/DUMMY')
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
@@ -75,40 +55,31 @@ const storage = multer.diskStorage({
|
||||
})
|
||||
|
||||
const upload = multer({storage})
|
||||
|
||||
|
||||
app.post('/upload/task', upload.single('file'), (req, res) => {
|
||||
console.log(req.body)
|
||||
console.log(req.file)
|
||||
|
||||
|
||||
|
||||
let uid = req.body.uid;
|
||||
let job_uid = req.body.job_uid;
|
||||
console.log(" req.body.uid -> ", uid)
|
||||
console.log(" req.body.job_uid -> ", job_uid)
|
||||
console.log(" process.env.COMMON_TASKFILE_PATH-> ", process.env.COMMON_TASKFILE_PATH)
|
||||
console.log(" process.env.COMMON_TASKF_PATH-> ", process.env.COMMON_TASKF_PATH)
|
||||
|
||||
let destinationDir = process.env.COMMON_TASKF_PATH !== undefined ? process.env.COMMON_TASKF_PATH : '/opt/wrenchboard/TEST/TASKFILE';
|
||||
|
||||
const fs = require('fs');
|
||||
const dir = process.env.COMMON_TASKFILE_PATH + "/" + job_uid;
|
||||
const dir = destinationDir + "/" + job_uid;
|
||||
if (!fs.existsSync(dir)){
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
|
||||
const oldPath = req.file.path; // 'old/path/file.txt'
|
||||
const oldPath = req.file.path;
|
||||
const newPath = dir + req.file.filename;
|
||||
|
||||
fs.rename(oldPath, newPath, function (err) {
|
||||
if (err) throw err
|
||||
console.log('Successfully renamed - AKA moved!')
|
||||
})
|
||||
|
||||
/*
|
||||
const dir2 = process.env.COMMON_TASKFILE_PATH + "/DUMMY/" + uid+"/"+job_uid;
|
||||
if (!fs.existsSync(dir2)){
|
||||
fs.mkdirSync(dir2);
|
||||
}
|
||||
*/
|
||||
return res.status(200).send('Completed')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user