Skip to content

reedu-reengineering-education/blacksmith-deno-cleanup-schedule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blacksmith Deno Cleanup Schedule

This project is a Deno script that runs on a schedule to delete temporary files from an S3 bucket and a PostgreSQL database. It uses the Deno standard library for loading environment variables, the Deno PostgreSQL library for interacting with the database, and the Deno S3 library for interacting with the S3 bucket.

Installation

  1. Clone the repository and navigate to the project directory.
  2. Install Deno: https://deno.land/#installation
  3. Run deno run --allow-read --allow-env --allow-net --unstable-cron main.ts to start the cleanup script.

Configuration

Before running the script, make sure to set the following environment variables:

  • DIRECT_URL: The URL of the PostgreSQL database.
  • S3_UPLOAD_KEY: The access key ID for the S3 bucket.
  • S3_UPLOAD_SECRET: The secret key for the S3 bucket.
  • S3_UPLOAD_REGION: The region of the S3 bucket.
  • S3_UPLOAD_ENDPOINT: The endpoint URL of the S3 bucket.
  • S3_UPLOAD_BUCKET: The name of the S3 bucket.

Schedule

The cleanup script is scheduled to run every day using Deno's Deno.cron function. You can modify the schedule by changing the cron expression in the script.