Environment Configuration Guide

This project uses a .env file to manage environment variables for runtime configuration. You can reference .env.sample for a complete list of supported variables and their sample values.

1. Shopper Details

These variables configure who is making the booking. SHOPPER_EMAIL is required - all others have sensible defaults. All string fields support template placeholders.

Variable Name Description Required Sample Value
SHOPPER_EMAIL Shopper email for confirmations Yes dobby@testing.eurostar.com
SHOPPER_FIRSTNAME Shopper first name No Booker
SHOPPER_LASTNAME Shopper last name No Test
SHOPPER_PHONENUMBER Shopper phone number No 7987654321
SHOPPER_PHONECOUNTRYCODE Shopper phone country code No +44

2. Passenger Details

These variables set default passenger information for travellers. All are optional with sensible defaults. All string fields support template placeholders, plus the additional {id} placeholder for per-passenger values.

Variable Name Description Sample Value
PASSENGERS_EMAIL Passenger email for tickets (optional) booking-bot-{scenario}-pax-{id}@testing.eurostar.com
PASSENGERS_LASTNAME Default passenger last name Test
PASSENGERS_PHONENUMBER Default passenger phone number 7987654321
PASSENGERS_PHONECOUNTRYCODE Default passenger phone country code +44

3. Config Options

These variables allow you to set CLI defaults via environment variables. All are optional. If set, they override CLI defaults. See .env.sample for all available options and their CLI equivalents.

Variable Name Description Sample Value
CONFIG_ITERATIONS Number of test iterations to run 10
CONFIG_WAIT Wait time between test runs (e.g., 1s, 1000) 1s
CONFIG_JITTER Jitter to add to wait time 0.5
CONFIG_OD Origin-destination pair paris-brussels
CONFIG_PAX Passenger configuration 2a
CONFIG_CLASSES Classes of service (comma-separated) STD,PLUS,PREMIER
CONFIG_DATES Date configuration tomorrow
CONFIG_OPEN Open links (comma-separated) checkout,voyager
CONFIG_DESTINATION Destination override brussels
CONFIG_VERBOSE Enable verbose logging (true/false) true
CONFIG_BOTENV Environment to use (lcl, dev, stg) dev
CONFIG_DEBUG Enable debug mode (true/false) false
CONFIG_DRY_RUN Dry-run mode (true/false) true
CONFIG_MANUAL Complete funnel manually checkout
CONFIG_SAVE_TO_FILE Save requests/responses to files auto
CONFIG_TIMINGS Request booking engine timings (true/false) false
CONFIG_LINKS Display links in logs (true/false) true
CONFIG_FIRST Select the first journey (true/false) false
CONFIG_LAST Select the last journey (true/false) false
CONFIG_PRSTACK PR stack to use for overriding servers 544
CONFIG_RESULTS_FILE Specify a file to write results output results.csv
CONFIG_TRAIN Train number to select from search results 9110
CONFIG_TIME Departure time to select from search results 08:15
CONFIG_MARKET Market code fr-fr
CONFIG_CURRENCY Currency code EUR
CONFIG_AFTER_SALES After-sales operations (comma-separated) api,ticket,pdf
CONFIG_API Auto-complete advanced passenger information true
CONFIG_TICKET Auto-fetch tickets true
CONFIG_PDF Auto-fetch PDF tickets true
CONFIG_LOG Save log to file log.txt
CONFIG_CID CID template pattern (see below) booking-bot-{carrier}-{scenario}-{i}-{datetime}-{type}-{pax}
CONFIG_SNAP Snap mode (LASTMIN, direct, STD only) true
CONFIG_UNALLOCATED Unallocated mode (RED_US, direct, UNASSIGNED) true
CONFIG_PRODUCT_FAMILY Override productFamilies in journey search LASTMIN
CONFIG_USER_AGENT Preset key (e.g. chrome, safari_ios) or literal UA string chrome_v147_mac
CONFIG_COOKIES Cookie header value (forwarded opaquely) name=value; foo=bar
CONFIG_CHECKOUT_VARIABLES_URL URL to a published checkout.json. Defaults to the GH Pages copy auto-published by .github/workflows/refresh-checkout.yml every 6h. The bot fetches from here before falling back to local Playwright refresh. Set to empty to disable. https://diegoeil.github.io/eurostar-booking-bot/checkout.json

Tip: For return journeys, you can set different class, train, or time values for outbound vs return using CLI options like --out:class, --rtn:train. See cli.md for details.

CID Template

The CONFIG_CID variable accepts a template string with {placeholder} variables that are resolved at runtime. If not set, the default pattern is used: booking-bot-{carrier}-{scenario}-{i}-{datetime}-{type}-{pax}.

Template Placeholders

Shopper, passenger, and CID string values all support {placeholder} template variables that are resolved at runtime. Commas in resolved values are replaced with - or _ for email address compatibility.

Placeholder Description Example Available in
{carrier} Carrier name eurostar all
{scenario} Route scenario LONPAR all
{type} Journey type (OW/RT) OW all
{pax} Passenger types (hyphen-separated) 1a, 2a-1c all
{od} Origin-destination 3-letter codes lon-par, bru-ams all
{i} Iteration number (zero-padded) 01 CID only
{id} Per-passenger ID 1, 2, 3 passenger fields only
{date} Date stamp (YYMMDD) 260316 all
{time} Time stamp (HHMMSS) 142530 all
{datetime} Combined date-time 260316-142530 all
{ts} Unix timestamp (ms) 1773854730000 all
{uuid} Short random ID (8 chars) a3f9b2c1 all
{market} Market code GB all
{env} Bot environment stg all

Examples:

# Dynamic passenger email with route and per-passenger context
PASSENGERS_EMAIL="bot-{od}-pax-{id}@testing.eurostar.com"

# Shopper email tagged with carrier and environment
SHOPPER_EMAIL="bot-{carrier}-{env}@testing.eurostar.com"

# CID with OD pair and UUID for uniqueness
CONFIG_CID="bot-{od}-{uuid}-{pax}"

4. Server URLs

These variables configure backend service endpoints for different environments. You usually do not need to change these unless you are working with custom stacks or local development.

See the bottom of .env.sample for all server variables. Example:

Variable Name Description Sample Value
SERVERS_STG_GATEWAY Staging API Gateway URL (internal, VPN) https://gateway.stg.eurostar.com
SERVERS_DEV_GATEWAY Development API Gateway URL https://api.dev.eurostar.com/gateway-pr-1072
SERVERS_LCL_GATEWAY Local API Gateway URL http://localhost:5050
SERVERS_GATEWAY Default API Gateway URL (internal, VPN) https://gateway.stg.eurostar.com
SERVERS_STG_SITE_API Staging public Site-API URL (no VPN) https://site-api-staging.eurostar.com
SERVERS_SITE_API Default public Site-API URL https://site-api-staging.eurostar.com

Other server variables follow the same pattern for VOYAGER, SEARCH, CHECKOUT, MYB, and API endpoints.

By default the bot calls the public Site-API externally (no VPN required), mimicking browser headers. Pass --gateway <PR-or-URL> to talk to a specific gateway directly instead - providing a gateway override automatically switches the bot into internal mode (VPN required).


Tip: Copy .env.sample to .env and edit as needed for your environment.


See also random.md for using dot (.) notation to randomize parameter values in environment variables.