$ git clone https://github.com/uktrade/directory-ui-supplier
$ cd directory-ui-supplier
$ make
Requires all host environment variables to be set.
$ make docker_run
$ brew link gettext --force (OS X only)
$ make docker_debug
$ make docker_test
.env
files will be automatically created (with env_writer.py
based on env.json
) by make docker_test
, based on host environment variables with DIRECTORY_UI_SUPPLIER_
prefix.
Host environment variable | Docker environment variable |
---|---|
DIRECTORY_UI_SUPPLIER_SECRET_KEY | SECRET_KEY |
DIRECTORY_UI_SUPPLIER_PORT | PORT |
DIRECTORY_UI_SUPPLIER_API_SIGNATURE_SECRET | API_SIGNATURE_SECRET |
DIRECTORY_UI_SUPPLIER_API_CLIENT_BASE_URL | API_CLIENT_BASE_URL |
DIRECTORY_UI_SUPPLIER_COMPANIES_HOUSE_SEARCH_URL | COMPANIES_HOUSE_SEARCH_URL |
DIRECTORY_UI_SUPPLIER_SSO_API_CLIENT_BASE_URL | SSO_API_CLIENT_BASE_URL |
DIRECTORY_UI_SUPPLIER_UI_SESSION_COOKIE_SECURE | UI_SESSION_COOKIE_SECURE |
$ make debug
$ make debug_webserver
$ make debug_test
npm install
npm run sass-dev
npm run sass-prod
npm run sass-watch
Signed cookies are used as the session backend to avoid using a database. We therefore must avoid storing non-trivial data in the session, because the browser will be exposed to the data.
To make sso work locally add the following to your /etc/hosts
:
127.0.0.1 buyer.trade.great.dev
127.0.0.1 supplier.trade.great.dev
127.0.0.1 sso.trade.great.dev
127.0.0.1 api.trade.great.dev
Then log into directory-sso
via sso.trade.great.dev:8001
, and use directory-ui-supplier
on buyer.trade.great.dev:8001
Note in production, the directory-sso
session cookie is shared with all subdomains that are on the same parent domain as directory-sso
. However in development we cannot share cookies between subdomains using localhost
- that would be like trying to set a cookie for .com
, which is not supported any any RFC.
Therefore to make cookie sharing work in development we need the apps to ne running on subdomains. Some stipulations:
directory-ui-supplier
anddirectory-sso
must both be running on sibling subdomains (with same parent domain)directory-sso
must be told to target cookies at the parent domain.
Follow the Django documentation
To create or update .po
files:
make debug_manage cmd="makemessages"
To compile .mo
files (no need to add these to source code, as this is done automatically during build):
make debug_manage cmd="compilemessages"