Skip to content

uktrade/directory-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

directory-api

code-climate-image circle-ci-image codecov-image gitflow-image calver-image

GREAT platform API


Development

Installing

$ git clone https://github.com/uktrade/directory-api
$ cd directory-api
$ virtualenv .venv -p Python3.9.2
$ source .venv/bin/activate
$ make install_requirements

Requirements

Configuration

Secrets such as API keys and environment specific configurations are placed in conf/env/secrets-do-not-commit - a file that is not added to version control. To create a template secrets file with dummy values run make secrets.

Commands

Command Description
make clean Delete pyc files
make pytest Run all tests
make pytest test_foo.py Run all tests in file called test_foo.py
make pytest -- --last-failed` Run the last tests to fail
make pytest -- -k foo Run the test called foo
make pytest -- Run arbitrary pytest command
make manage Run arbitrary management command
make webserver Run the development web server
make requirements Compile the requirements file
make install_requirements Installed the compile requirements file
make css Compile scss to css
make secrets Create your secret env var file
make worker Run the celery worker
make beat Run the celery beat scheduler
make checks Run isort, black and flake8 in check-only mode
make autoformat Run isort, black and flake8 in update-files mode

SSO

To make sso work locally add the following to your machine's /etc/hosts:

IP Adress URL
127.0.0.1 buyer.trade.great
127.0.0.1 supplier.trade.great
127.0.0.1 sso.trade.great
127.0.0.1 api.trade.great
127.0.0.1 profile.trade.great
127.0.0.1 exred.trade.great

Then log into directory-sso via sso.trade.great:8004

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 by any RFC.

Therefore to make cookie sharing work in development we need the apps to be running on subdomains. Some stipulations:

  • directory-ui-supplier and directory-sso must both be running on sibling subdomains (with same parent domain)
  • directory-sso must be told to target cookies at the parent domain.

Linux setup

Linux (Fedora 27) instructions are available here

Helpful links

Related projects:

https://github.com/uktrade?q=directory https://github.com/uktrade?q=great