Static configuration
How to configure your Comentario server
The Comentario server’s static (start-up) configuration can be defined in three ways, in order of precedence:
- YAML configuration file
- Command-line options
- Environment variables
All three methods are functionally equivalent, but precedence applies: values in the configuration file override command-line options, which in turn override environment variables. Availability of each method depends on the specific setting.
When in doubt, use a YAML configuration file for your Comentario instance. It is the most complete and convenient option, offering a declarative format that works well with version control systems. In this case, the only required setting is specifying the file with the -c <file_name.yaml>
command-line option (or the equivalent $CONFIG_FILE
environment variable).
The easiest way to get started with a YAML-based config is allowing Comentario to write out its current settings using the following command:
comentario --config-write-to=/path/to/file.yaml
Then you can modify all settings to your taste.
Command-line help
You can also get a complete list of supported command-line options and variables by running:
./comentario -h
Synopsis
comentario [OPTIONS]
Options
Below is a list of available configuration settings (options).
YAML config | Command-line | Environment variable | Default value | Description |
---|---|---|---|---|
-h --help | Show help message (option summary) and exit. | |||
-c VALUE--config =VALUE | $CONFIG_FILE | Path to a YAML file to load the configuration from. | ||
--config-write-to =VALUE | When specified, causes Comentario to save its current config to given YAML file and exit. | |||
secrets | --secrets =VALUE | $SECRETS_FILE | secrets.yaml | Path to YAML file with secrets. |
host | --host =VALUE | $HOST | localhost | The IP to listen on. If you want to accept connections from any network interface, use value 0.0.0.0 . |
port | --port =VALUE | $PORT | 8080 | The port to listen on. |
maxListen | --max-listen =VALUE | 0 | Maximum number of outstanding requests. 0 means no limit. | |
cleanupTimeout | --cleanup-timeout =VALUE | 10s | Grace period for which to wait before killing idle connections. | |
gracefulTimeout | --graceful-timeout =VALUE | 15s | Grace period for which to wait before shutting down the server. | |
maxHeaderSize | --max-header-size =VALUE | 1MiB | Maximum number of bytes to read for request header (not request body). | |
keepAlive | --keep-alive =VALUE | 3m | TCP keepalive timeout on accepted connections. | |
readTimeout | --read-timeout =VALUE | 30s | Maximum duration before request read times out. | |
writeTimeout | --write-timeout =VALUE | 60s | Maximum duration before response write times out. | |
baseUrl | --base-url =VALUE | $BASE_URL | http://localhost:8080 | Server’s own base URL. |
baseDocsUrl | --base-docs-url =VALUE | $BASE_DOCS_URL | https://docs.comentario.app | Base documentation URL. Comentario provides numerous links to various docpages in the Admin UI and the embedded part. By default, points to Comentario production documentation. |
tosUrl | --tos-url =VALUE | $TOS_URL | <baseDocsUrl>/en/legal/tos/ | URL of the Terms of Service page. |
privacyPolicyUrl | --privacy-policy-url =VALUE | $PRIVACY_POLICY_URL | <baseDocsUrl>/en/legal/privacy/ | URL of the Privacy Policy page. |
cdnUrl | --cdn-url =VALUE | $CDN_URL | The base URL | Static file CDN URL. |
staticPath | --static-path =VALUE | $STATIC_PATH | . | Path to static (frontend) files. |
superuser | --superuser =VALUE | $SUPERUSER | UUID or email of a user to become a superuser. | |
homeContentUrl | --home-content-url =VALUE | $HOME_CONTENT_URL | URL of a HTML page to display on Comentario homepage. If not specified, the home page wil redirect the user to the login page. | |
maxImportFileSize | --max-import-file-size | $MAX_IMPORT_FILE_SIZE | 10MiB | Maximum import file size. This can be either a number of bytes, or a number followed by a unit (B =bytes, KB =kilobytes, MB =megabytes etc.). |
Logging options | ||||
-v , --verbose | Verbose logging (use -vv for debug logging). If specified, overrides --log.level . | |||
log.level | --log.level =VALUE | $LOG_LEVEL | warning | Log verbosity level. Will be overridden to info if -v is given, or to debug if -vv is given on the command line. |
log.noColor | --log.no-color | $LOG_NO_COLOR | Disable log colouring with ANSI control sequences. | |
log.fullIPs | --log.full-ips | $LOG_FULL_IPS | Log IP addresses in full. When omitted, only first two bytes of IP addresses will be stored in fields such as user’s signup IP. Applies to both IPv4 (172.168.x.x ) and IPv6 (692e:eace:x:x:x:x:x:x ) addresses. | |
Database options | ||||
db.maxIdleConns | --db.max-idle-conns =VALUE | $DB_MAX_IDLE_CONNS | 10 | Maximum number of idle DB connections. |
db.debug | --db.debug | Enable database debug logging (meant for development purposes). | ||
Statistics options | ||||
stats.disablePageViews | --stats.disable-page-views | $STATS_DISABLE_PAGE_VIEWS | Disable page view statistics gathering and reporting. | |
stats.maxDays | --stats.max-days | $STATS_MAX_DAYS | 30 | Statistics retention and reporting period, in days. |
Live update options | ||||
liveUpdate.disable | --lu.disable | $NO_LIVE_UPDATE | Disable live updates via WebSockets. | |
liveUpdate.maxClients | --lu.max-clients =VALUE | $WS_MAX_CLIENTS | 10000 | Maximum number of WebSocket clients available for Live update. |
Development options | ||||
dev.disableXSRF | --dev.disable-xsrf | Disable XSRF protection. This option is meant for development purposes only; each production environment should have XSRF protection activated. | ||
dev.swaggerUI | --dev.swagger-ui | Enable Swagger UI at /api/docs . | ||
dev.e2e | --dev.e2e | Start server in the end-to-end testing mode. This option is meant for development purposes only. |
Legal pages
Comentario provides users with links to the following legal policy pages in a number of places:
- Terms of Service, which defaults to
<baseDocsUrl>/en/legal/tos/
- Privacy Policy, which defaults to
<baseDocsUrl>/en/legal/privacy/
Apart from being required by law in many countries, such a page is often mandatory when configuring federated authentication via an external service. By default, the above URLs on the documentation website are used.
If you apply your own policies, you should reconfigure Comentario to using your own URLs. Such pages have to be hosted elsewhere as Comentario provides no means for storing them at the moment.
Dynamic configuration defaults
Comentario YAML config also allows to redefine default values for dynamic configuration items.
In order to do that define corresponding overrides under the key dynamicConfigDefaults
, for example:
dynamicConfigDefaults:
auth:
signup:
confirm:
commenter: false
user: true
domain.defaults:
comments:
text:
maxLength: 417
enableVoting: true
editing:
author: true
moderator: false
You can find the key name on the item page, under the heading. Allowed value datatypes are string, number, and boolean.