GCP_BUCKET_FOLDER_NAME:GWM

This commit is contained in:
sriramv 2023-03-14 08:20:27 +05:30
parent f23156a45a
commit 4cf7aaf2a1

View File

@ -250,9 +250,10 @@ exports.GetCreditPdData = async (req, res) =>
ImageData = [];
const storage = new Storage({ keyFilename : path.join(__dirname, "../../googleCloud.json") });
const bucketName = process.env.GCP_BUCKET_NAME;
const bucketFolderName = process.env.GCP_BUCKET_FOLDER_NAME;
for(const PhotographsValue of data[0].dataValues.Photographs)
{
const fileName = 'credit-pd/pd'+PhotographsValue.ref_no+'/images/'+PhotographsValue.img;
const fileName = bucketFolderName+'/pd'+PhotographsValue.ref_no+'/images/'+PhotographsValue.img;
const options = {version: 'v2', action: 'read',expires: Date.now() + 1000 * 60 * 60, };
const [url] = await storage.bucket(bucketName).file(fileName).getSignedUrl(options);