Skip to content

Configuration

Cezary Kluczyński edited this page Jan 5, 2023 · 21 revisions

The main way of providing configuration to STAPI is through Java properties.

First, follow basic setup guildlines on copying properties file into the right location.

When properties are in place, configuration can be done.

Configuration specific to Spring itself is described in Spring documentation.

Configuration using profiles

The following profiles can be turned on and off for different effects:

  • stapi-custom - lets us have an application-stapi-custom.properties file in the same directory as application.properties. This file is ignored by Git.
  • genderize - whether or not connect to Genderize.io. When profile is present, connection would be made, and gender of real people will be decided upon responses from this API. If it is not gender accuracy that's currently important, it is advised that this profile be not present. Genderize.io offers 1000 free request a day, a number that could be exceeded when multiple tests are run, but a number well bellow what is needed for single datafeed, which required 150 to 200 API requests to Genderize.io.
  • docker - profile used for when STAPI's Docker image is built. Changes compared to non-Docker version are minimal and only related to where some static files are stored in the Docker container.

Note: Profiles default and stapi-custom should always be on.

Configuration properties

Database properties

  • spring.datasource.url - URL of database, check Spring documentation for details
  • spring.datasource.hikari.username - database username
  • spring.datasource.hikari.password=stapi - database password

Logging

  • logging.file.path - subdirectory For Logs. Default to ./logs
  • logging.config - location of logback config. Default to classpath:logback-spring.xml

The remaining properties prefixed with logging. are responsible for logging levels for a various packages. The exact configuration can be found https://github.com/cezarykluczynski/stapi/blob/master/server/src/main/resources/logback-spring.xml.

Sources

  • source.mediawiki.memoryAlphaEn.apiUrl - URL of Memory Alpha API, or it's local fork.
  • source.mediawiki.memoryBetaEn.apiUrl - URL of Memory Beta API, or it's local fork. For the remaining properties, see common properties section.
  • source.genderize.apiUrl - URL of Genderize.io API.
  • source.wordpress.starTrekCards.apiUrl - URL of StarTrekCards.com.
  • wordPress.starTrekCards.minimalInterval - minimal interval between requests for StarTrekCards.com. Default to 3000.

Common properties for all MediaWiki sources

All MediaWiki sources share common properties:

  • source.mediawiki.XXX.minimalInterval - minimal interval of requests. Default to auto. Could be either auto or number of milliseconds. If set to auto, it will be 0 for local fork, and one second for Wikia's wiki.
  • source.mediawiki.XXX.logPostpones - should the fact that API request was postponed be logged. Default to false.
  • source.mediawiki.XXX.intervalCalculationStrategy - how should the interval between requests be calculated. Possible values are FROM_BEFORE_SEND, and FROM_AFTER_RECEIVED. FROM_BEFORE_SEND means that the interval will be calculated from before the request was send, and another request will be send, for example, 1000 milliseconds after the last one was send. FROM_AFTER_RECEIVED means that the interval will be calculated from after the response was received, and another request will be send, for example, 1000 milliseconds after the last response was received.

ETL configuration

  • spring.batch.job.enabled - when this is set to true, ETL routines written on top of Spring Batch will execute the first time application is started, and all consecutive times, for all enabled steps. When this is set to false, no ETL routines nor database migrations will be executed.

Steps configuration

Every can be configured in a similar manner. All steps share the same properties:

  • step.XXX.enabled=true - whether or not this step is turned on. When step is turned off, step reader is provided with an empty list of objects to process, and, as a result, step is marked as completed immediately.
  • step.XXX.commitInterval=50 - how ofter should the resulting entities be saved. Commit interval 1, when found, should not be changed, because steps that have it were not tested with higher intervals. Steps with commit interval higher than 1 could be tuned.
  • step.XXX.order=1 - order in which steps are executed. Currently not used, but validated - no duplicated order values are allowed.

Legal documents

Terms of service and privacy policy can be configured with properties. Both files are optional, HTML-formatter text files (without <html>, <head>, and <body> tags, just the formatting), that will be used on /terms-of-service and /privacy-policy pages, respectivelly.

  • legal.termsOfService - full path to terms of service.
  • legal.privacyPolicy - full path to privacy policy.
Clone this wiki locally