spring.profiles.active=${ACTIVE_PROFILE:dev}
There are three profiles used dev, prod , container.
dev : Used only for development without authentication enabled.
prod: Authentication enabled
container: Used for docker-compose deployment
Private-Kit Server uses anonymous authentication through Captcha token.
By default there is a Captcha implementation based on HCaptcha
IF you want to implement your own Captcha validation you have to re-implement the com.privatekit.server.filter.CaptchaFilter
captcha.site-key=${CAPTCHA_SITE_KEY:YOUR-SITE-KEY}
captcha.secret=${CAPTCHA_SECRET:YOUR-SECRET}
captcha.verify-url=${CAPTCHA_VERIFY_URL:https://hcaptcha.com/siteverify}
Enable metrics on PrivateKit-Service is easy because it is using spring-boot-starter-actuator.
By default only the health endpoint is enabled: /actuator/health
Private-Kit Server expects a PostgreSQL database compatible with jdbc driver 42.2.X
The configuration is in the src/main/resources/application.properties
Spring Boot Configuration file.
The database version control is performed by Liquibase.
The root changelog file is located in src/main/resources/db/changelog/changelog-master.xml
. From this one all other changelogs are imported. The first one has a sql reference for creating the hole schema.
All JPA mappings are located in com.privatekit.server.entity
package.
The database has several relations but the mapping would contain only a few JPA Joins because of performance concerns.
For all interaction the choice is Spring Data repositories located in com.privatekit.server.repository
Survey API supports store surveys in different languages. The API uses the standard HTTP Header accept-language in order to determine the language to associate to thre survey.
For Example, POST a new survey
curl --location --request POST 'https://localhost:8080/v1.0/myNamespace/survey/' --header 'Content-Type: application/json' --header 'Accept-Language: en' --data-raw '{ ... }'
The HTTP Header accept-language is MANDATORY. If the header is not present a HTTP Bad Request (400) will be returned.
There are persistence tests in com.privatekit.server.PrivateKitServicePersistenceTest
that use an H2 memory database to test almost all repository interactions.
An mvn
wrapper is bundled.
./mvnw spring-boot:run
curl localhost:8080
docker build -t privatekit/self-reporting-server .
docker run -p 8080:8080 privatekit/self-reporting-server