Skip to content

Environment Configuration

The FreightFlow ecosystem relies on environment variables for service discovery, security orchestration, and terminal connectivity. This guide details the configuration for both the Backend and the Scraper services.

WARNING

Keep your .env files secure. Never commit them to version control. Replace the placeholders below with your actual credentials.


1. FreightFlow Backend Configuration

The backend manages the primary logic, database, and task orchestration.

Core Configuration

VariableDescriptionDefault / Example
ENVIRONMENTDeployment mode (development or production).development
DEBUGEnables detailed error logging.True
SECRET_KEYKey for JWT signing. Generate using openssl rand -hex 32.<SHARED_SECRET_KEY>
ACCESS_TOKEN_EXPIRE_MINUTESJWT token validity duration.11520 (8 days)

Database & Message Broker

VariableDescriptionPlaceholder
DATABASE_URLAsyncpg connection string for PostgreSQL.postgresql+asyncpg://user:pass@host:5432/db
CELERY_BROKER_URLRedis URL for Celery task queuing.redis://redis:6379/0
REDIS_CACHE_HOSTRedis host for application-level caching.redis

Cargoes Flow Integration

VariableDescription
CARGOES_FLOW_API_KEYAPI Key for external Cargoes Flow services.
CARGOES_FLOW_ORG_TOKENOrganizational token for Cargoes Flow.
WEBHOOK_SECRETSecret to validate incoming Cargoes Flow webhooks.

Microsoft OAuth (SSO)

VariableDescription
MICROSOFT_TENANT_IDAzure AD Tenant ID for organization-level SSO.
MICROSOFT_CLIENT_IDClient ID for your Azure registered application.
MICROSOFT_CLIENT_SECRETClient Secret for your Azure application.
MICROSOFT_REDIRECT_URIcallback URL registered in the Azure portal.

Scraper Orchestration

VariableDescription
SCRAPER_ENDPOINTSJSON Array of terminal scraper URLs.
SCRAPER_API_KEYThe X-API-TOKEN used to authenticate with the scraper.

IMPORTANT

Precedence Warning: Within SCRAPER_ENDPOINTS, ensure the PNCT terminal is listed first if it contains legacy data that must be processed before other updates.


2. Freight Flow Scraper Configuration

The scraper handles terminal-specific automation and requires credentials for each port portal.

Security & Connectivity

VariableDescription
X_API_TOKENShared secret to allow the backend to call the scraper.
BACKEND_WEBHOOK_URLThe URL where the scraper posts results back to the backend.
WEBHOOK_SECRET_KEYSecret key for webhook signature validation.

Microsoft/Outlook Automation

Used to automate the retrieval of verification codes for terminal logins.

  • OUTLOOK_EMAIL: Automation account email.
  • OUTLOOK_PASSWORD: App password for the automation account.

Terminal Credentials

Provide credentials for each terminal portal implemented in the system.

  • Maher Terminal: MAHER_TERMINAL_USERNAME, MAHER_TERMINAL_PASSWORD, MAHER_CSP_URL
  • Port Houston: PORT_HOUSTON_USERNAME, PORT_HOUSTON_PASSWORD
  • Fenix Marine: FENIX_MARINE_USERNAME, FENIX_MARINE_PASSWORD
  • Yusen / YTI: YUSEN_USERNAME, YUSEN_PASSWORD
  • EModal: EMODAL_USERNAME, EMODAL_PASSWORD
  • POMTOC: POMTOC_USERNAME, POMTOC_PASSWORD
  • Conley: CONLEY_USERNAME, CONLEY_PASSWORD
  • ITS: ITS_USERNAME, ITS_PASSWORD
  • ONE Carrier: ONE_USERNAME, ONE_PASSWORD

Deployment Logic

The system is configured to prioritize environment-specific files:

  1. Development: Use .env.dev for local Docker environments.
  2. Production: Use .env.prod. This file is loaded by Docker Compose in production and typically contains the long-lived secrets and domain-managed URLs.

FreightFlow Platform Documentation