Skip to content

Commit

Permalink
Make fuel types an env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKobayashi committed Aug 7, 2022
1 parent 362a90e commit 6e5f0fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ docker run -d --name fuelhook fuelhook
## Environment variables

- TZ - Sets the timezone for logs (uses tzdata format, e.g. "Australia/Brisbane". Defaults to UTC)
- REGION - the name of the region (or state), this is one of All, VIC, NSW, QLD, WA. On top of this, there is also All-2, VIC-2, NSW-2, QLD-2, WA-2, All-3, VIC-3, NSW-3, QLD-3, WA-3. These represent the 2nd and 3rd best prices for each respective region.
- REGION - Selects the region (or state) that you'd like to retrieve fuel prices for. This is one of All, VIC, NSW, QLD, WA. On top of this, there is also All-2, VIC-2, NSW-2, QLD-2, WA-2, All-3, VIC-3, NSW-3, QLD-3, WA-3. These represent the 2nd and 3rd best prices for each respective region.
- FUEL_TYPES - Selects the fuel types you want to get prices for. Must be structured as a JSON list (e.g. `'["E10", "U91", "U98"]'`)
- WEBHOOK_URL - Sets the URL for your webhook (Discord-compatible, may work with other webhooks)
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from time import strftime, localtime

# Define fuel types to check
fuelTypes = ["E10", "U91", "U95", "U98", "Diesel", "LPG"]
fuelTypes = json.loads(os.environ.get("FUEL_TYPES"))

# Set the URL for the ProjectZeroThree API
apiURL = "https://projectzerothree.info/api.php?format=json"
Expand All @@ -26,7 +26,7 @@
file.close()

# Get current price data from the API and parse the JSON
apiResponse = requests.post(apiURL, headers={"User-Agent": "FuelHook v2.3"})
apiResponse = requests.post(apiURL, headers={"User-Agent": "FuelHook v2.3.1"})
priceDataAPI = json.loads(apiResponse.text)

# Get the last updated time from the API
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
environment:
- "TZ=UTC"
- "REGION=All"
- "FUEL_TYPES=[\"E10\", \"U91\", \"U95\", \"U98\", \"Diesel\", \"LPG\"]"
- "WEBHOOK_URL="
volumes:
- type: volume
Expand Down

0 comments on commit 6e5f0fe

Please sign in to comment.