Skip to content

Commit

Permalink
update:uploads file path
Browse files Browse the repository at this point in the history
  • Loading branch information
Vehbi Ozcan committed Jun 22, 2024
1 parent db0708b commit e5ea898
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon v1/src/app.js"
"start": "cross-env NODE_ENV=production nodemon v1/src/app.js",
"dev": "cross-env NODE_ENV=development nodemon v1/src/app.js"
},
"keywords": [],
"author": "",
Expand Down
20 changes: 16 additions & 4 deletions v1/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ const dotenv = require('dotenv');
const errorHandler = require('./middlewares/errorHandler');
const notFound = require('./middlewares/notFound');

const directory = path.join(__dirname, '../../../../../../aicostsqo-static/uploads');
let envFile = process.env.NODE_ENV == "production" ? ".env.production" : ".env.development";

//Enviroment Variables
dotenv.config(
{
path: `./config/env/${envFile}` //dotenv config içerisine config dosyamızın path ini verdik
})


const directory = path.join(__dirname, process.env.UPLOADS_PATH_FILE);
//const directory = path.join(__dirname, '../../../../../../aicostsqo-static/uploads');

//console.log(directory);
//console.log(__dirname);
dotenv.config({
path: './config/.env', //dotenv config içerisine config dosyamızın path ini verdik
});
// dotenv.config({
// path: './config/.env', //dotenv config içerisine config dosyamızın path ini verdik
// });

config();
loaders();

Expand Down
2 changes: 1 addition & 1 deletion v1/src/scripts/utils/fileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const uploadFile = (file, folderToSave, extensionRules = null) => {
__dirname,
'../',
'../',
'../../../../../../aicostsqo-static/uploads',
process.env.UPLOADS_PATH_FILE,
folderToSave
);

Expand Down
3 changes: 2 additions & 1 deletion v1/src/scripts/utils/uploadsFolderOrganizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const getFolderAbsolutePath = (folderName) =>
*/

const getFolderAbsolutePath = (folderName) =>
pathCombiner(__dirname, '../', '../', '../../../../../../aicostsqo-static/uploads', folderName);
pathCombiner(__dirname, '../', '../', process.env.UPLOADS_PATH_FILE, folderName);
//pathCombiner(__dirname, '../', '../', '../../../../../../aicostsqo-static/uploads', folderName);

const getFolderPath = (folderName) => pathCombiner('uploads', folderName);

Expand Down

0 comments on commit e5ea898

Please sign in to comment.