This course is about how JavaScript declares names and what kinds of values it has: const and
let, typeof, null and undefined, empty values, and mixing text with numbers. Values that are
missing, empty, or text are where JavaScript quietly carries on, or gives a different answer from
Python’s. Along the way, you’ll port Kestrel Print’s Python backup check.
Here’s one of those places, on a new server where nobody set BACKUP_BUCKET. These are the check’s
key lines in Python. On that server, the check refuses to start:
import os
import sys
bucket = os.environ.get("BACKUP_BUCKET")
region = os.environ.get("BACKUP_REGION")
mode = "live"
retries = 3
if bucket is None:
print("No BACKUP_BUCKET set: refusing to start.")
sys.exit(1)
print(f"Backing up to {bucket} in {region} ({mode})")
print(f"Up to {retries + 1} attempts")
print(f"Debug: bucket is {type(bucket).__name__}")
It prints its refusal and exits with status 1:
No BACKUP_BUCKET set: refusing to start.