- Clone the
data-access-apirepo in the same parent folder and set up environment variables as explained in thedata-access-apiREADME.md.
- docker and docker compose.
- create a
.env.devfile and input environment variables - ask a developer in the SGAR team for them.
- Run the following:
docker compose up -d --buildThis should build both the data-access-api and egar-public-site-ui.
- The frontend will now be running on port 3000.
- To see changes on the frontend, reload the page.
The airport codes used by the app are generated from a CSV file.
- To add or update an airport code: edit
src/common/app_data/airport_codes.csv. - Then run the Node script below to regenerate
src/common/app_data/airport_codes.json.
# From the project root
node scripts/generate_airport_codes.jsNotes:
- Do not manually edit
src/common/app_data/airport_codes.json; it is derived from the CSV. - The generator enforces sorting and normalisation and will overwrite the JSON file.
- The resulting JSON includes an additional
valuefield (priority: IATA > ICAO > first otherCode). - when filling the airport_codes.csv, the "otherCodes" column should hold a comma separated list of airport codes that don't match IATA or ICAO.
| name | ICAO | IATA | OtherCode | crownDependency | designated | british | label | Comment |
|---|---|---|---|---|---|---|---|---|
| Kautokeino Air Base | ENKA | QKX | FALSE | FALSE | FALSE | Kautokeino Air Base (QKX / ENKA) | ICAO/IATA aircodes | |
| Bedwell Hey Farm Ely Rd | E201 | FALSE | TRUE | TRUE | Bedwell Hey Farm Ely Rd | Not IATA/ICAO airfield |
Run the below to access the node container, which will have all the installed dependencies, so you can run the npm test script.
docker exec -it node sh
# Now run the test script
npm run testRun the following to access the database so you can run SQL commands.
docker exec -it database sh
# Log into postgres with the following command
psql -U user -d egar
# RUN you sql commands after wards- To use the mock clamav container, you need to specific the following environment variables in the
.env.dev:
CLAMAV_BASE=http://mock-clamav
CLAMAV_PORT=8080In general you don't need to run gateway-api and data-integr-cbp, unless:
- You want to mock submitting a GAR to CBP.
- If you are mocking a flight from a foreign country to the UK and need check their UPT status.
- Files are organised to match route path, e.g. ./app/garfile/manifest --> http://localhost:3000/garfile/manifest.
- Occasionally, the route path may deviate from this rule e.g. upload gar spreadsheet is under
./api/uploadgarrather than./garfile/garupload.
- Occasionally, the route path may deviate from this rule e.g. upload gar spreadsheet is under
- GET and POST request handlers are separated out in
get.controller.jsandpost.controller.js. ./testfile structure roughly maps the./appfile structure e.g. test/garfile/garupload/get.controller.test.jsis the test for./app/garfile/garupload/get.controller.js`.publicfolders contains frontend scripts, stylesheets and html that is sent to the user.localescontains text used in the app.commoncontains common functionalty used in app.
In order to prevent unnecessary generation of token, we added an exclusion list. This list holds the path patterns for routes that don't use CSRF tokens. This was introduced as part of the ticket sGAR: CSRF .
The list is maintained in this file src/common/config/csrfExclusionList.js