Sign inSign up

3lightstechnology/hpd-api

By 3lightstechnology

•Updated 2 months ago

Health Project Dashboard API

Image
0

6.9K

3lightstechnology/hpd-api repository overview

⁠Health Project Dashboard API

Note: This image needs to run database migrations for working. To avoid any unexpected behavior the version must be the same than the image of the main project.
(e.g.: 3lightstechnology/hpd-api-db-migrations:1.1-hpd-migrations -> 3lightstechnology/hpd-api:1.1.0)

⁠How to use this image

⁠Expose port

The API runs on port 8080.

⁠Environment variables

⁠API configuration

API_PORT

Defines the API exposed port. By default is set at 8080.

ENCRYPTION_KEY

Some data needs to be crypted in database, this variable defines the encryption key.

REDIRECT_URL_RESET_LOST_PASSWORD

Redirect url to finalize reset password process. Url have to contain /#/reset-password?token=[TOKEN]. E.g.: https://hpd.3lights-technology/#/reset-password?token=[TOKEN]

API contains some rate limit on endpoints:

  • To create a user: RATE_LIMIT_CREATE_USER_PER_SECOND and RATE_LIMIT_CREATE_USER_MAX each are define to 1 by default
  • To login: RATE_LIMIT_GET_OAUTH_TOKEN_PER_SECOND and RATE_LIMIT_GET_OAUTH_TOKEN_MAX each are define to 1 by default
  • To verify token: RATE_LIMIT_VERIFY_OAUTH_TOKEN_PER_SECOND and RATE_LIMIT_VERIFY_OAUTH_TOKEN_MAX each are define to 1 by default

BASIC_AUTH_API_USER

Defines the user of the basic authentification to API. By default is set at api.

BASIC_AUTH_API_PASSWORD

Defines the user password of the basic authentification to API.

OAUTH_TOKEN_PRIVATE_KEY

Defines the private to generate the token after user login.

⁠Database

DATABASE_HOST

Defines the host of the database.

DATABASE_PORT

Defines the port of the database. By default is set at 5432.

DATABASE_USERNAME

Defines the username of the user database.

DATABASE_USER_PASSWORD

Defines the password of the user database.

DATABASE_NAME

Defines the name of the database.

DATABASE_MAX_POOL_SIZE

Defines the max of the connection pool size of the database. By default is set at 50.

DATABASE_SSL

Defines if the connection to the database must use SSL. By default is set at true.

⁠Email

CONTACT_SENDER_EMAIL

Defines the email of the sender when someone needs to contact the platform customer service.

CONTACT_RECIPIENT_SENDER_EMAIL

Defines the email of the recipient when someone needs to contact the platform customer service.

NO_REPLY_SENDER_EMAIL

Defines the email of no reply.

MAIL_SMTP_URL

Defines the url of the SMTP server.

MAIL_SMTP_PORT

Defines the port of the SMTP server. By default is set at 465.

MAIL_USER

Defines the user of the SMTP server.

MAIL_PASSWORD

Defines the password of the SMTP server.

⁠Start via docker compose

version : '3.7'

services:
  db            :
    image      : postgres:14.2
    ports      :
      - "5432:5432"
    environment:
      POSTGRES_DB      : api_db
      POSTGRES_USER    : api_user
      POSTGRES_PASSWORD: api_password

  migrations_hpd:
    image      : 3lightstechnology/hpd-api-db-migrations:[TAGNAME]
    environment:
      DATABASE_HOST    : "[DATABASE_HOST]"
      DATABASE_USER    : "[DATABASE_USER]"
      DATABASE_PASSWORD: "[DATABASE_PASSWORD]"
    depends_on :
      - db

  hpd           :
    image      : 3lightstechnology/hpd-api:[TAGNAME]
    environment:
      [ ... ]
    ports      :
      - "8001:8080"
    depends_on :
      - migrations_hpd

⁠How to use API

A documentation of endpoints is available on: [URL]/v1/redoc or [URL]/v1/swagger

⁠Troubleshooting

In local environment this database error appears The server does not support SSL connections. To remove it turn SSL connection with this environment variable DATABASE_SSL=false.

Tag summary

Content type

Image

Digest

sha256:f5cb270a3…

Size

81.6 MB

Last updated

2 months ago

docker pull 3lightstechnology/hpd-api:1.22.4