Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

ministryofjustice/fb-mock-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FB Mocks

Installation

npm install

Usage

npm start

This starts mocked services on these ports

  • 44444 - User Datastore
  • 44445 - User Filestore
  • 44446 - Submitter

You can now run the runner or editor with a command like so

cd /path/to/runner-or-editor

SERVICE_SLUG=slug \
SERVICE_SECRET=secret \
SERVICE_TOKEN=token \
USER_DATASTORE_URL=http://localhost:44444 \
USER_FILESTORE_URL=http://localhost:44445 \
USER_FILESTORE_URL=http://localhost:44446 \
SERVICE_PATH=/path/to/form \
npm start

Using .env file

If you have a .env file, it will be loaded automatically if you specify the MOCKENV environment varibale

MOCKENV=yes npm start

Setting alternative ports

USER_DATASTORE=4001 \
USER_FILESTORE=4002 \
SUBMITTER=4003 \
npm start

Enabling sending of emails

MAIL='Form Builder <form-builder-messages@digital.justice.gov.uk' npm start

Configuring sendmail.postfix on OS X

1. Create app password

If you're using your digital.justice.gov.uk account to send from, you need to use an app password

Create a Google app password

2. Edit postfix configuration
sudo vi /etc/postfix/main.cf

Add the following:

### Additions
relayhost=smtp.gmail.com:587
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_use_tls=yes
smtp_tls_security_level=encrypt
smtp_sasl_security_options = noanonymous
smtp_always_send_ehlo = yes
smtp_sasl_mechanism_filter = plain
3. Create sasl_passwd file for postifx
sudo vi /etc/postfix/sasl_passwd

Add the follwing

smtp.gmail.com:587 your_email@digital.justice.gov.uk:your_password

Create the Postfix lookup table from the sasl_passwd file

sudo postmap /etc/postfix/sasl_passwd
4. Start postfix

If postfix is not running

sudo postfix start

otherwise

sudo postfix reload

Enabling sending of sms messages

Create a trial account at Twilio

Create a number to send from and find your Account Sid and Auth Token in the console

ACCOUNTSID='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
AUTHTOKEN='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
MOBILE='+447777123456' \
npm start

Utils

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published