Tools used by the interventions dev team in day-to-day operations.
Automatically configure the access token and hostname for community-api and make the call.
🙋♂️ Usage checklist:
- Your active namespace is
hmpps-interventions-dev
; - You are connected to the VPN.
$ ./get_namespace_community_api_call.sh /secure/offenders/crn/D002399/allOffenderManagers | jq
Calling API using default namespace (hmpps-interventions-dev)
Using (needs VPN) https://community-api-secure.test.delius.probation.hmpps.dsd.io/secure/offenders/crn/D002399/allOffenderManagers
Getting access token using default namespace (hmpps-interventions-dev)
[
{
"staffCode": "N02P054",
"staffId": 2500001781,
"isResponsibleOfficer": true,
{snip}
This script semi-automates the article in Cloud Platform user guide.
The alternative approach of running queries would be to run a psql
container, but that has significant drawbacks:
- all input and output is automatically log collected
- this means any accidental exposure of personal information would be retained in the logs
This port-forwarding method provides an alternative that still requires credentials to access the namespace, but does not expose sensitive information accidentally.
🚨 Please read data at rest on MoJ-issued laptops for guidance on storing sensitive data (query output).
$ ./setup_preprod_port_forward.sh
pod/port-forward-username created
pod/port-forward-username condition met
✨ Turning on port-forwarding to hmpps-interventions-preprod
✨ Use Ctrl-C to exit and cleanup
🧑💻 Connect to the database via localhost:5433 and hmpps-interventions-preprod postgres credentials
Forwarding from 127.0.0.1:5433 -> 5432
Forwarding from [::1]:5433 -> 5432
To exit, press Ctrl+C and wait for the pod to terminate.
View the credentials with kubectl get secret/postgres14 -n hmpps-interventions-preprod -ojson | jq '.data | map_values(@base64d)'
You can use any database tool.
If you want to use psql
locally, connect via psql -h localhost -p 5433 -U database_username database_name
:
$ psql -h localhost -p 5433 -U cpS00... dba32...
<password prompt>