github.com/companieshouse/insolvency-api@v0.0.0-20231024103413-440c973d9e9b/README.md (about) 1 # Insolvency API 2 3 [![GoDoc](https://godoc.org/github.com/companieshouse/insolvency-api?status.svg)](https://godoc.org/github.com/companieshouse/insolvency-api) 4 [![Go Report Card](https://goreportcard.com/badge/github.com/companieshouse/insolvency-api)](https://goreportcard.com/report/github.com/companieshouse/insolvency-api) 5 6 API code and specification for submitting insolvency data to Companies House 7 8 ## Requirements 9 10 The recommended way to run this API is via the CHS Docker development mechanism (see [here](https://github.com/companieshouse/docker-chs-development) for more details). 11 12 In order to run this API locally, however, you would need to install the following: 13 14 - [Go](https://golang.org/doc/install) 15 - [Git](https://git-scm.com/downloads) 16 - [MongoDB](https://www.mongodb.com/) 17 18 ## Running Locally with Docker CHS 19 20 Clone Docker CHS Development and follow the steps in the README. 21 22 Enable the `insolvency` module. 23 24 As this is an ERIC-routed service, call endpoints via the base url of: `http://api.chs.local:4001`. To check things are running, you might wish to try the healthcheck endpoint: `{base_url}/insolvency/healthcheck` 25 26 Development mode is available for this service in Docker CHS Development. 27 28 `./bin/chs-dev development enable insolvency-api` 29 30 ## Running locally with Docker but without Docker CHS - Not recommended 31 32 Pull image from private CH registry by running docker pull 169942020521.dkr.ecr.eu-west-1.amazonaws.com/local/insolvency-api:latest command or run the following steps to build image locally: 33 34 1. `export SSH_PRIVATE_KEY_PASSPHRASE='[your SSH key passhprase goes here]'` (optional, set only if SSH key is passphrase protected) 35 2. `DOCKER_BUILDKIT=0 docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" --build-arg SSH_PRIVATE_KEY_PASSPHRASE -t 169942020521.dkr.ecr.eu-west-1.amazonaws.com/local/insolvency-api .` 36 3. `docker run 169942020521.dkr.ecr.eu-west-1.amazonaws.com/local/insolvency-api:latest` 37 38 However, this service has multiple dependencies e.g. on ERIC, Transactions API, Company Lookup, and EFS Submission API, so simply will not work in isolation. 39 40 ## Running locally without Docker - Not recommended 41 42 1. Clone this repository: `go get github.com/companieshouse/insolvency-api` 43 1. Build the executable: `make build` 44 45 The same microservice dependecy considerations apply as with local Docker builds - this service is not intended to run in isolation. 46 47 ## Configuration 48 49 | Variable | Default | Description | 50 | :------------------------------ | :------ | :---------------------- | 51 | `BIND_ADDR` | `-` | Insolvency API Port | 52 | `MONGODB_URL` | `-` | MongoDB URL | 53 | `INSOLVENCY_MONGODB_DATABASE` | `-` | MongoDB database name | 54 | `INSOLVENCY_MONGODB_COLLECTION` | `-` | MongoDB collection name | 55 56 ## Spec 57 58 When this service is live, specs will be available on the Companies House Developer Hub. As a courtesy during development, an OpenAPI 3 spec has been included in the `/apispec` folder, along with a description of how to use this API alongside the Transactions API (the Insolvency API is inseparable from that wider transactions-based model). 59 60