Sign inSign up

sdcplatform/ras-secure-message

By sdcplatform

•Updated over 5 years ago

Secure message service for RAS

Image
0

10K+

sdcplatform/ras-secure-message repository overview

⁠ras-secure-message

The api for the messaging functionality between respondents and the ONS.

⁠Setup

Install Docker⁠

Install postgresql

brew install postgresql

Install pipenv

pip install pipenv

Use pipenv to create a virtualenv and install dependencies

pipenv install

Alternatively you can use make

make build

Set environmental variables. Replace $SOURCE_ROOT with the parent directory of the project.

RAS_SM_PATH=$SOURCE_ROOT/ras-secure-message
LOGGING_LEVEL = DEBUG

⁠Run the application

docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -d postgres
pipenv run python run.py
 * Running on http://127.0.0.1:5050/
 * Restarting with reloader

or

docker-compose up

or (when postgres is set up)

make start

⁠Test the application

Ensure dev dependencies have been installed

make build

Ensure there is a postgres instance running on port 5432

docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -d postgres

Run the tests with make

make test # Runs linters, behave and unit tests
make lint # Runs linters only

Note: Ensure APP_SETTINGS isn't set in .env as it could cause the tests to fail in a non obvious way.

Run the behave tests with:

pipenv run behave # Runs all of the tests
pipenv run behave tests/behavioural/features/thread_get.feature # Runs individual feature test

⁠Test the response

Now open up a prompt to test out your API using curl

$ curl http://127.0.0.1:5050/health
{"status": "healthy"}

⁠Configuration

Environment variables available for configuration are listed below:

Environment VariableDescriptionDefault
LOGGING_LEVELLog level for the application'DEBUG'
SECURITY_USER_NAMEUsername for basic authN/A
SECURITY_USER_PASSWORDPassword for basic authN/A
JWT_SECRETSECRET used to code JWTN/A
DATABASE_URLDatabase URIpostgresql://postgres:postgres@localhost:5432
NOTIFICATION_TEMPLATE_IDTemplate id for Gov Notify serviceN/A
NOTIFY_VIA_GOV_NOTIFYToggle for using Gov Notify for notifications'1' (enable Gov Notify email notifications)
PARTY_URLURL of the ras-party serviceN/A
CLIENT_IDID of the client service in UAAN/A
CLIENT_SECRETPassword of the client service in UAAN/A
UAA_URLURL of a UAA instanceN/A
USE_UAASets whether a client token should be retrieved1

⁠Database migrations

Although there exists a 'migrations' folder for SQL database migration files, this service does not currently use any database migration tools such as Alembic. As such, the migration files are simply there for record-keeping purposes. Migration scripts will need to be performed manually on the database.

Tag summary

Content type

Image

Digest

Size

222.6 MB

Last updated

over 5 years ago

docker pull sdcplatform/ras-secure-message