<commit_before># Postcode Anywhere Stub Server
## Using with Docker
### Prerequisites
### Installing Docker Container
Build the docker image
```bash
docker build -t postcode-anywhere-stub .
```
Run the docker image
```bash
docker run -it --detach -p 127.0.0.1:9040:9040 --name postcode-anywhere-stub postcode-anywhere-stub
```
Open in a browser ```https://localhost:9040/``` and add an exception for the ssl key.
## Local Installation
### Prerequisites
#### Install Go
```bash
brew install go
export GOPATH=$HOME/go
```
### Installation
Clone the service into a new directory
```bash
mkdir ~/go/src/github.com/thomaslorentsen/
cd ~/go/src/github.com/thomaslorentsen/
git clone <EMAIL>:thomaslorentsen/postcode-anywhere-stub.git
```
### Install SSl Keys
Generate the SSL keys needed to run over https
```bash
mkdir -p ~/go/bin/
cd ~/go/bin/
openssl genrsa -out server.key 2048
openssl req -new -x509 -sha256 -key server.key -out server.pem -days 3650
```
## Building
Compile the source
```bash
go install github.com/thomaslorentsen/postcode-anywhere-stub
```
### Running Server
Run the server located in the bin folder
```bash
$GOPATH/bin/postcode-anywhere-stub
```
## Using Server
Once Post Code Anywhere has been initiated, the host can be set to use the stub server.
In the browser console run:
```javascript
pca.host = 'localhost:9040'
```
## Flags
The ssl certificate and key can be set with
```bash
./postcode-anywhere-stub  -cert server.pem -key server.key
```
The port that the server binds to can be set with<commit_msg>Update documentation<commit_after># Postcode Anywhere Stub Server
This provides a stub server for the post code anywhere api.
## Using with Docker
The service can be run inside a docker container.
### Prerequisites
You will need docker installed
### Installing Docker Container
Build the docker image.
```bash
docker build -t postcode-anywhere-stub .
```
Run the docker image
```bash
docker run -it --detach -p 127.0.0.1:9040:9040 --name postcode-anywhere-stub postcode-anywhere-stub
```
Open in a browser ```https://localhost:9040/``` and add an exception for the ssl key.
## Local Installation
### Prerequisites
#### Install Go
```bash
brew install go
export GOPATH=$HOME/go
```
### Installation
Clone the service into a new directory
```bash
mkdir ~/go/src/github.com/thomaslorentsen/
cd ~/go/src/github.com/thomaslorentsen/
git clone <EMAIL>:thomaslorentsen/postcode-anywhere-stub.git
```
### Install SSl Keys
Generate the SSL keys needed to run over https
```bash
mkdir -p ~/go/bin/
cd ~/go/bin/
openssl genrsa -out server.key 2048
openssl req -new -x509 -sha256 -key server.key -out server.pem -days 3650
```
## Building with go get
You can use go to fetch and compile the source for you with the following command:
```bash
go get github.com/thomaslorentsen/postcode-anywhere-stub
```
The server will then be installed
## Building from source
Compile the source
```bash
go install github.com/thomaslorentsen/postcode-anywhere-stub
```
### Running Server
Run the server located in the bin folder
```bash
$GOPATH/bin/postcode-anywhere-stub
```
## Using Server
Once Post Code Anywhere has been initiated, the host can be set to use the stub server.
In the browser console run:
```javascript
pca.host = 'localhost:9040'
```
## Flags
The ssl certificate and key can be set with
```bash
./postcode-anywhere-stub  -cert server.pem -key server.key
```
The port that the server binds to can be set with
{'fraction_non_alphanumeric': 0.11584476218266705, 'fraction_numerical': 0.02100962941348118, 'mean_word_length': 4.4499205087440385, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5117452', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1074, 'n_words': 423}