# Prism Remote API

This serves as a API Server in front of [Light](https://gitlab.com/utiliflex/Juice/light-sts6)
to handle receiving token requests via a restful HTTP API. API documentation is
[available here](https://api.utiliflex.com/prism-api/#introduction).

## Setup

To setup PrismAPI download the latest copy from [Utiliflex OPS site](https://ops.utiliflex.com/pub/Prism-API/STS-6/)
and extract the contents to _/opt/prism-api_

    mkdir /opt/prism-api
    tar -C /opt/prism-api -xvf prism-api-v1.0.0.tar.xz

Then create the system user account that will run the daemon:

    adduser --system --shell /sbin/nologin juice

Then copy over the _config.toml-dist_ file and configure accordingly.

Lastly install and enable the SystemD service file:

    cp /opt/Prism-API/init/systemd/prism-api.service /etc/systemd/system/
    systemctl enable --now prism-api.service

## Generate a JWT token to use with light

Prism-API expects each instance of light to use it's own JWT token. A new token
can be generated with the following:

    /opt/prism-api/prism-api -gentoken

## Development

### Linting

The `make lint` target depends on [golangci-lint][ci-lint], to install this
follow the [official installation instructions][ci-lint-install].

[ci-lint]: "https://github.com/golangci/golangci-lint"
[ci-lint-install]: "https://golangci-lint.run/usage/install/#local-installation"
