diff --git a/api.js b/api.js index 0a3a405..0ec267e 100644 --- a/api.js +++ b/api.js @@ -216,7 +216,7 @@ async function set_up_api_server(app) { return res.sendStatus(404); } - const gz_image_path = `${screenshot_filename}.gz`; + var gz_image_path = `${screenshot_filename}.gz`; if (process.env.USE_CLOUD_STORAGE == "true"){ const storage = new Storage(); @@ -237,6 +237,7 @@ async function set_up_api_server(app) { res.status(404).send(`Error retrieving image from GCS`); } }else{ + gz_image_path = `${SCREENSHOTS_DIR}/${gz_image_path}`; const image_exists = await check_file_exists(gz_image_path); if(!image_exists) { @@ -404,7 +405,7 @@ async function set_up_api_server(app) { })); }else{ await Promise.all(screenshots_to_delete.map(screenshot_path => { - return asyncfs.unlink(screenshot_path); + return asyncfs.unlink(`${SCREENSHOTS_DIR}/${screenshot_path}`); })); } const payload_fires = await PayloadFireResults.destroy({ diff --git a/docker-compose.yml b/docker-compose.yml index 6866c44..47e9d9c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,11 +10,10 @@ services: volumes: # Directory where payload fire images are stored. - ./payload-fire-images:/app/payload-fire-images + - ~/.config/gcloud/application_default_credentials.json:/gcloud.json depends_on: postgresdb: condition: service_healthy - volumes: - - ~/.config/gcloud/application_default_credentials.json:/gcloud.json postgresdb: image: postgres restart: always