{
  "slug": "railway-config-targets-project-environment-and-service-through-environment-varia-966d4454dde5",
  "title": "railway config targets project, environment, and service through environment variables",
  "tools": [
    "railway"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-03-25T20:15:20.000Z",
  "announced_at": "2026-03-25T20:15:20.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When running a Railway CLI command without persisted link state, set both project and environment IDs; the CLI then builds the linked project from those IDs. Set the service ID optionally to target a service.",
    "examples": [
      "RAILWAY_TOKEN=<project-token> RAILWAY_PROJECT_ID=<project-id> RAILWAY_ENVIRONMENT_ID=<environment-id> RAILWAY_SERVICE_ID=<service-id> railway status"
    ],
    "gotchas": [
      "Version: v4.35.0",
      "RAILWAY_PROJECT_ID (required): Project ID; must be set together with RAILWAY_ENVIRONMENT_ID for env-var targeting.",
      "RAILWAY_ENVIRONMENT_ID (required): Environment ID; must be set together with RAILWAY_PROJECT_ID for env-var targeting.",
      "RAILWAY_SERVICE_ID: Service ID to use; if absent, the CLI may use a service from the locally linked project configuration.",
      "RAILWAY_TOKEN (required): Authentication token required for this env-var project targeting path; Railway documents project tokens for project-scoped CLI actions.",
      "Prerequisite: Authenticate with a Railway token; the v4.35.0 targeting code errors when no Railway auth token is available. Railway documents RAILWAY_TOKEN for project-scoped operations.",
      "The `LinkedProject` is constructed on the fly when both project ID and environment ID environment variables are set."
    ]
  },
  "why_it_matters": "Run Railway CLI commands in a CI or scripting workflow that cannot persist link state on disk.",
  "before": "The CLI deployment guide instructs users to run `railway link` before `railway up` when the project is not already linked.",
  "sources": [
    "https://github.com/railwayapp/cli/releases/tag/v4.35.0",
    "https://github.com/railwayapp/cli/pull/823",
    "https://github.com/railwayapp/cli/blob/v4.35.0/src/config.rs",
    "https://docs.railway.com/cli/login",
    "https://docs.railway.com/cli/deploying"
  ],
  "rank": 0.94033,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1b-20261016",
    "verdict_id": "wave1b-20261016:wave1b-20261016-90698cc34ca8e87d-0:gate",
    "evidence_hash": "abf07f082f8c1fe48df114e428080d9b6d4320d32609ad27d3b903265818eab0"
  },
  "review": {
    "draft_hash": "5060a07485eb9525335a16b891c38a98c8a61e1b5e1a51bcd3c9607fbbeef1bd",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1b-20261016:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.94 >= 0.9; 2 needed) and Jev gave 0.78 (>= 0.6 needed)."
  }
}
