Configuring the backend
Commento's backend is configured by a set of environment variables. If you're executing the binary from the command line, you can set environment variables:
$ export COMMENTO_ORIGIN=http://commento.example.com # no whitespace around = $ ./commento
You can also configure Commento using a configuration file specified with
COMMENTO_CONFIG_FILE. You can find specifications for this file in the section on configuration files.
This should be set to the subdomain or the IP address hosting Commento. All API requests will go to this server. This may include subdirectories if Commento is hosted behind a reverse proxy, for example. Include the protocol in the value to use HTTP/HTTPS.
A PostgreSQL server URI, including the database name.
A configuration file for Commento. See the section on the configuration file for more details. Useful to store secrets and credentials. No config file will be loaded by default, if left unspecified.
The address to bind the Commento server to. Useful if the server has multiple network interfaces. If not specified, this value defaults to
The port to bind the Commento server to. Defaults to 8080.
When in Docker
You don't need to set
COMMENTO_PORT if you're running Commento in Docker. Instead, set the external bind address and port with Docker's
Useful if you'd like to use a CDN with Commento (like AWS Cloudfront, for example) for faster delivery of static assets. You must set the CDN's origin value as
COMMENTO_ORIGIN. If not specified, a CDN is not used.
Used to disable new dashboard registrations. Useful if you are the only person using Commento on your server. Does not impact the creation of accounts for your readers. Defaults to false.
If you want to store the binary in a different directory from the static assets, set this directory to point to the static assets (HTML, JS, CSS, email templates and database migrations). Defaults to the same directory as the binary.
If set to true, all static content will be served GZipped if the client's browser supports compression. Defaults to false.
SMTP credentials and configuration the server should use to send emails. By default, all settings are empty and email features such as email notification and reset password are turned off.
Akismet API key. Create a key in your Akismet dashboard. By default, Akismet integration is turned off when this value is left empty.
Google OAuth configuration. Create a new project in the Google developer console to generate a set of credentials. By default, Google login is turned off when these values are left empty.
GitHub OAuth configuration. Create a new OAuth app in GitHub developer settings to generate a set of credentials. By default, GitHub login is turned off when these values are left empty.
Google OAuth configuration. Create a new application in your GitLab settings to generate a set of credentials. By default, GitLab login is turned off when these values are left empty.
Twitter OAuth configuration. Create an app in the Twitter developer dashboard to generate a set of credentials. By default, Twitter login is turned off when these values are left empty.
COMMENTO_CONFIG_FILE environment variable, you can specify a configuration file. You can use this file to store secrets and credentials without exposing them in the
./commento invocation command. For example, a Docker secret can be created and mounted inside the container's filesystem, and Commento can read from this file.
If you're specifying a configuration file using
COMMENTO_CONFIG_FILE, note that it will have lower precedence than environment variables.
The format for the configutation file is quite simple:
- Each configuration value is specified in one line
- Leading and trailing whitespaces on each line are ignored
- All lines starting with a
#are treated as comments and ignored
- All empty lines are ignored
- Each valid configuration line must contain an
Here is an example file:
# Set binding values COMMENTO_ORIGIN=http://commento.example.com COMMENTO_PORT=80 # Set PostgreSQL settings COMMENTO_POSTGRES=postgres://commento:firstname.lastname@example.org:5432/commento?sslmode=disable # Set the SMTP credentials COMMENTO_SMTP_HOST=smtp.gmail.com COMMENTO_SMTP_PORT=587 COMMENTO_SMTP_USERNAMEemail@example.com COMMENTO_SMTP_PASSWORD=hunter2 COMMENTO_SMTP_FROM_ADDRESSfirstname.lastname@example.org # Set Google OAuth credentials COMMENTO_GOOGLE_KEY=204475040454-chmuz29vz2xldxnlcmnvbnrlbn.apps.googleusercontent.com COMMENTO_GOOGLE_SECRET=09HTEVfU0VDUkVUPTh4
Say we store this file in
/etc/commento.env. Then, we can include this file when running Commento:
$ export COMMENTO_CONFIG_FILE=/etc/commento.env $ ./commento