config.py contains server configuration variables.
The location of the SQLite database file. defaults to data.db
in the current working directory. Can be overridden with the DATABASE_FILE_PATH
environment variable.
The amount of time in seconds before another view by the same user will count.
Length of cookie value (stored client side). Literally just the cookie size.
The template of the SVG to respond with. Must take count
, width
, recWidth
, textX
and url
.
Enable Prometheus metrics at the /metrics
endpoint. Defaults to false for performance reasons. Can be overridden with the EXPOSE_METRICS
environment variable. However, use this feature with care. It is recommended only for moderately large deployments of hit-counter, as a separate metric will be exposed for every URL in your data base.
Configure the prefix to me used for all Prometheus measurements. Defaults to hitcounter
, resulting in metrics labels like hitcounter_hits_total
.
The number of top domains to display on the home page; set to 0 to disable. Can be overridden with the NUM_TOP_DOMAINS
environment variable.
The number of top URLs to display on the home page; set to 0 to disable. Can be overridden with the NUM_TOP_URLS
environment variable.
Regular expressions to ignore when getting top sites. If a URL matches one of these expressions, the URL will be ignored in the domain calculation.
Regular expressions to decide which URLs to count and return an SVG for. If the server identifies a URL that does not match a regular expression in this list, it will return a 403. Leaving this list empty will disable the whitelist feature.
For example, adding r'github\.com'
will only allow URLs with github\.com
in them to be given a non-403 response.
Regular expressions to decide which URLs to block and return a 403 for. Blacklist regular expressions are checked before whitelist regular expressions.
For example, adding r'example\.com'
will block all requests for example.com.