Skip to content

Latest commit

 

History

History
73 lines (55 loc) · 1.35 KB

File metadata and controls

73 lines (55 loc) · 1.35 KB

PEA FT Value Fetcher

This project fetches the FT (Fuel Tariff) value from the PEA (Provincial Electricity Authority) website and returns it as a JSON response.

Setup

  1. Clone the repository:

    git clone https://github.com/racksync/pea-ft.git
    cd pea-ft
  2. Install dependencies:

    npm install
  3. Create a default.env file and add your Telegram credentials:

    TELEGRAM_BOT_TOKEN=your_telegram_bot_token
    TELEGRAM_CHAT_ID=your_telegram_chat_id
    
  4. Rename default.env to .env:

    mv default.env .env
  5. Build the project:

    npm run build
  6. Run the project locally:

    npm start

Deploy to Cloudflare Workers

  1. Install Wrangler CLI:

    npm install -g wrangler
  2. Login to Cloudflare:

    wrangler login
  3. Publish the Worker:

    wrangler publish

Configure Worker Schedule

To configure the worker schedule interval, update the wrangler.toml file. For example, to run the worker every 5 minutes, set the schedule as follows:

[triggers.crons]
schedule = "*/5 * * * *"

Usage

Send a request to the endpoint to fetch the current FT value:

curl https://your-worker-subdomain.workers.dev

License

This project is licensed under the MIT License.