Skip to content

Allow overriding Airtable base IDs via env vars#307

Open
ankit0504 wants to merge 1 commit intoLanguage-Mapping:masterfrom
ankit0504:agupta/airtable-base-id-env-var
Open

Allow overriding Airtable base IDs via env vars#307
ankit0504 wants to merge 1 commit intoLanguage-Mapping:masterfrom
ankit0504:agupta/airtable-base-id-env-var

Conversation

@ankit0504
Copy link
Copy Markdown
Collaborator

Issues resolved by this pull request

None — quality-of-life change for contributors who don't have access to the upstream ELA Airtable bases.

This PR is independent of the in-flight upgrade stack (#304, #305, #306). It targets `master` and can land in any order relative to those.

Prerequisites

  • No install or build behavior changes.
  • No `.env` changes required for anyone with access to the ELA production bases — the defaults are the existing hardcoded IDs, so existing setups are unchanged.
  • Contributors without ELA base access can now duplicate the schema into their own workspace and set `REACT_APP_AIRTABLE_BASE` (and optionally `REACT_APP_AIRTABLE_CENSUS_BASE`) in `.env` to point the local dev build at it.

Review type

  • FYI: small, additive change with no behavior change in the default case.
  • Content/copy
  • Needs feedback
  • Functionality
  • Code

What's in this PR

  • `src/components/config/api.ts`: `AIRTABLE_BASE` and `AIRTABLE_CENSUS_BASE` now read from `process.env.REACT_APP_AIRTABLE_BASE` / `REACT_APP_AIRTABLE_CENSUS_BASE` with the existing hardcoded ELA IDs (`applPEl3BsnpuszQu`, `appjb6Qnp4lTNz7Gn`) as fallbacks. The defaults preserve current behavior.
  • `sample.env`: document the two new optional vars with a comment explaining when a contributor would want to set them.

Motivation

The project README already warns: "Your setup will need to match ours, or you'll want to edit the code to your needs." This removes the "edit the code" friction — contributors without ELA base access can now run the app locally against their own duplicated base without making a local-only code change to `api.ts` that has to be stashed before every push.

Verification done locally

  • `yarn build` — passes (CRA production build unchanged).
  • With `REACT_APP_AIRTABLE_BASE` set in a local `.env`, runtime Airtable requests now target the override base; with it unset they continue to target the ELA base.

What to review

  • `AIRTABLE_BASE` and `AIRTABLE_CENSUS_BASE` still resolve to the ELA IDs when the new env vars are unset.
  • No other code reaches the `applPEl3BsnpuszQu` / `appjb6Qnp4lTNz7Gn` literals directly (confirmed via grep — only `api.ts` referenced them).
  • `sample.env` comment is accurate and useful.

Introduce REACT_APP_AIRTABLE_BASE and REACT_APP_AIRTABLE_CENSUS_BASE
env vars with the existing ELA production IDs as fallbacks. The
upstream ELA Airtable bases are private, so contributors without
access cannot run the app locally against real data. With this
change they can duplicate the schema into their own workspace and
point the local dev build at it via .env, while the default
behavior for anyone with access to the ELA bases is unchanged.

Also document the two new vars in sample.env.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant