Skip to content

Latest commit

 

History

History
118 lines (77 loc) · 3.46 KB

README.md

File metadata and controls

118 lines (77 loc) · 3.46 KB

EV Backend

The backend HTTP server running on the EV and being accessible through the Bluetooth HTTP Proxy.

1. Documentation

1.1. REST API

The OpenAPI specification is provided here. Use Swagger Editor to display it.

1.2. Configuration

The EV Backend can be configured with the following environment variables:

CSR Endpoint CSR_ENDPOINT A URL to the Certificate Signing Request (CSR) Endpoint. Default is http://emsp.localhost.

Output File OUTPUT_FILE The file path where to write the Contract Certificate to. Default is ./output/cc.cer.

1.2.1. eMSP Configuration

Available eMSPs can be configured by creating and editing the following three files:

Warning: The ./config directory's is excluded from versioning because it may contain secrets! You can use the configuration examples provided in example-config and adjust them to your environment.

./config/emsp.json and the ./config/emsp_secrets.json file. Make sure that the emsp_secrets.json file maps from an eMSP's id to its OAuth client secret!

The files are described in the following sections.

1.2.1.1. Public eMSP Authorization Server Configuration

Example:

[
  {
    "id": "sample_emsp",                  // The eMSP ID.
    "name": "Example eMSP",               // The displayed name of the eMSP in the User Agent.
    "base_url": "https://as.example.com", // The base URL of the eMSP's Authorization Server.
    "image": "assets/openid_charge.svg"   // (Optional) URL to the eMSP's logo displayed in the User Agent.
  }
]
1.2.1.2. Secret eMSP Authorization Server Configuration

Example:

{
  "sample_emsp": {  // The eMSP ID.
    "client_id": "example_emsp",  // The Client ID of the EV at the eMSP's Authorization Server.
    "client_secret": "aBc...giJ"  // The Client Secret of the EV at the eMSP's Authorization Server.
  }
}
1.2.1.3. eMSP Backend Server Configuration
{
  "sample_emsp": "https://emsp.example.com" // Base URL of the eMSP's Backend Server.
}

1.3. Requirements

  • Connection to the eMSP Backend and the eMSP's Authorization Server.

2. Development

Go commands:

# Load packages
go get

# Start server. Will be available on http://localhost:8080
go run ./main.go

# Builds the server with all its dependencies to the single binary "server"
go build -a -installsuffix cgo -o server .

Docker commands:

# Build the container as "ev-backend:latest" image
docker build --pull --rm -f "Dockerfile" -t ev-backend:latest "./"

# Run the built container. Server will be available on http://localhost:8080 and store certificate to ./output/cc.cer
docker run -p "8080:8080" -v "./output:/app/output" ev-backend:latest