Skip to content

leosac/card-printing-worker

Repository files navigation

Card Printing Worker Build Status

An autonomous (Node.js) server to generate bitmaps for cards (CR-80 and others), usually for card printers.

It can be used as a standalone microservice and is maintained/distributed as a core component of Leosac Credential Provisioning solution.

Run

From source

  • Install Node.js >= 16.10 and Yarn.
  • git clone https://github.com/leosac/card-printing-worker.git
  • cd card-printing-worker
  • yarn install
  • yarn run dev

With Docker

  • Install Docker
  • docker pull leosac/leosac-card-printing-worker:snapshot
  • docker create --name leosac-cpw --init -p 4000:4000 -v /var/local/lcpw/repo:/data/repository leosac/leosac-card-printing-worker:snapshot
  • To log traces into a file instead of the console output, add the following parameters to the previous docker create command: -v /var/local/lcpw/logs:/data/logs -e LOGGING_TYPE=file -e LOGGING_LEVEL=http
  • docker start leosac-cpw

Using MSI package (Windows only)

  • Install latest MSI package
  • Start Leosac.PrintingWorker service (Leosac Credential Provisioning Printing Worker Service)

Configuration

Configuration is done through environment variables. You can use dotenv to create such variables by creating .env file at the root folder. See .env.example.

If using docker, define variables when creating the container with -e VARIABLE=VALUE.

Use

By default, the server can be reached on http:https://localhost:4000/. The REST API is documented with an embedded Swagger UI on http:https://localhost:4000/swagger/ and also available on SwaggerHub.

JSON template samples can be found on repository folder. Such templates have to follow js-cardrendering format and can easily be created with js-cardeditor.