Please install Node.js >= v18
and npm >= v9
. You will probably find it
easier to use the Node Version Manager nvm
To use the correct version of Node.js for this application, via nvm:
$ cd cdp-defra-id-demo
$ nvm use
Install application dependencies:
$ npm install
You have to configure the OIDC URL, client secret and possibly the service id
and client id
.
This depends on which ID provider you connect this demo to.
If integrating with the CDP DEFRA-ID Stub during development you need to follow the configurations detailed in github.com/DEFRA/cdp-defra-id-stub/readme#integrate. E.g. setting the client secret and OIDC URL properties.
For local development either:
- set these as env-vars
DEFRA_ID_OIDC_CONFIGURATION_URL
andDEFRA_ID_CLIENT_SECRET
(preferred) - hard code them as defaults in
src/config/index.js
(not encouraged)
For running a service in a CDP environment set it in either
- cdp-app-config (temporary only)
- in your service's secrets: Secrets (preferred)
To run the application in development
mode run:
$ npm run dev
Whilst the APIs are being developed this app uses a local JSON mock API. To start this locally run:
$ npm run mockApi
To mimic the application running in production
mode locally run:
$ npm start
All available Npm scripts can be seen in package.json To view them in your command line run:
$ npm run
The Publish GitHub Actions workflow auto versions a Pull Requests code with a minor
version once it has been merged into the main
branch.
All you have to do is commit your code and raise a Pull Request and the pipeline will auto version your code for you.
If you wish to patch
or major
version your codebase use:
$ npm version <patch|major>
Then:
- Push this code with the auto generated commit to your GitHub Repository
- Raise a Pull Request
- Merge your code into the
main
branch - The Publish GitHub Actions workflow will tag and push your
major
orpatch
version tags to your GitHub Repository - The Publish GitHub Actions workflow will release your
major
orpatch
versioned code
Build:
$ docker build --target development --no-cache --tag cdp-defra-id-demo:development .
Run:
$ docker run -p 3000:3000 cdp-defra-id-demo:development
Build:
docker build --no-cache --tag cdp-defra-id-demo .
Run:
$ docker run -p 3000:3000 cdp-defra-id-demo
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
The following attribution statement MUST be cited in your products and applications when using this information.
Contains public sector information licensed under the Open Government license v3
The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.