Skip to content

Coko-Foundation/ketty-flax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flax microservice

This microservice generates static websites with the data from books created with Ketty. It exposes the following endpoints:

  • POST /api/auth
  • POST /preview
  • POST /publish

The /api/auth authenticates a client and returns an JWT accessToken with lifespan of 8h, which is used to communicate with the service. A valid call to this endpoint should containt the authorization header with value Basic base64encoded(clientId:clientSecret). Client id and secret should be created and registered beforehand.

The /preview endpoint will generate a temporary preview of the book, without recreating the images or storing any other assets associated with it. The previews are deleted every 24 hours.

The /publish endpoint will generate a standalone book, with images and other assets stored in the book folders, which can be shared via its unique URL. Published books can be found under: https://{{flax url}}/books/{{bookId}}

Creating client's credentials

When the service is up by executing docker exec -it <name_of_the_pagedjs_server_container> yarn create:client.
The above will produce a valid pair of clientId and clientSecret

Required env variables

SECRET
POSTGRES_HOST
POSTGRES_DB
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_PORT
POSTGRES_ALLOW_SELF_SIGNED_CERTIFICATES
CLIENT_ID
CLIENT_SECRET
NODE_ENV

Starting the service

The service is fully dockerized for ease of use for either development or for use in production.

Production

In the root of the service run docker-compose -f docker-compose.production.yml up This container contains just the service. An external Postgres DB should be provided.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors