Skip to content

Configuration Reference

At minimum, you must set APP_URL and AUTH_PROVIDERS for your instance to function properly. This guide provides a complete reference for all configuration options available in Karr.

Karr can be configured through a configuration file or environment variables.

Any field from the config file can be set with an envvar.

They follow the same naming as their config file counterpart. The only exception is the db config, which is prefixed by DB_, e.g. DB_NAME, DB_PASSWORD, DB_PASSWORD_FILE

By default, the config file should be located in a config/ directory at the root of the project and named karr.config.*. These can be overridden by the CONFIG_DIR and CONFIG_FILENAME environment variables respectively.

The config file can be in YAML, JSON5, or JSON format.

The configuration schema is available at https://karr.mobi/config.schema.json.

OptionTypeDescription
APP_URLURLThe base URL where your Karr instance can be accessed, without any path components. Must end with a /.
AUTH_PROVIDERSListThe list of authentication providers to enable on your instance
OptionTypeDefaultDescription
APPLICATION_NAMEString"Karr"The name of your application instance.
API_PORTNumber1993The port on which the API server will listen.
API_BASEString"/api"The base path for API endpoints. Must start with a / and have no trailing slash.
LOG_TIMESTAMPBooleantrueWhether to include timestamps in logs.
LOG_LEVELString"info"The log level to use. Available options: "trace", "debug", "info", "warn", "error".
ADMIN_EMAILEmailThe email address of the admin user.

Karr supports multiple authentication providers through the AUTH_PROVIDERS configuration option.

  • Password: Email/password authentication
  • Code: One-time code authentication via email
OptionRequiredTypeDescription
nameStringThe name of the provider (password or code)
trustedBooleanWhen set to true, users authenticated through this provider are considered verified. Default: false.
OptionRequiredTypeDescription
nameStringThe name of the provider (github)
clientIDStringThe Client ID from the Auth provider
clientSecretStringThe Client Secret from the Auth provider
queryObjectAdditional query parameters to include in authorization requests.
trustedBooleanWhen set to true, users authenticated through Github are considered verified. Default: false.
OptionRequiredTypeDescription
nameStringThe name of the provider (google)
clientIDStringThe Client ID from the Auth provider
queryObjectAdditional query parameters to include in authorization requests.
trustedBooleanWhen set to true, users authenticated through Google are considered verified. Default: false.

🚀 Coming soon! This is not yet implemented, it will come in the near future.

You can directly specify target instances to federate with.

Database connection details can be configured through the DB_CONFIG option:

OptionTypeDefaultDescription
hostString"localhost"Database server hostname.
portNumber5432Database server port.
userString"postgres"Database username.
passwordStringDatabase password. Not recommended for production use.
password_fileStringPath to a file containing the database password. Recommended for production with Docker Secrets.
db_nameString"karr"Database name.
sslBooleanfalseWhether to use SSL for database connections.

Here’s an example of a complete configuration:

config/karr.config.yaml
# yaml-language-server: $schema=https://karr.mobi/config.schema.json
APPLICATION_NAME: "My Karr Instance"
APP_URL: "https://karr.example.com/"
API_PORT: 3000
API_BASE: "/api"
LOG_LEVEL: "info"
LOG_TIMESTAMP: true
ADMIN_EMAIL: "admin@example.com"
AUTH_PROVIDERS:
- name: "password"
trusted: false
- name: "google"
clientID: "your-google-client-id"
trusted: true
FEDERATION_TARGETS:
- name: "Partner Instance"
url: "https://karr.partner-example.com"
DB_CONFIG:
host: "db"
port: 5432
user: "karr_user"
password_file: "/run/secrets/db-password"
db_name: "karr_db"
ssl: true
config/karr.config.json
{
"$schema": "https://karr.mobi/config.schema.json",
"APPLICATION_NAME": "My Karr Instance",
"APP_URL": "https://karr.example.com/",
"API_PORT": 3000,
"API_BASE": "/api",
"LOG_LEVEL": "info",
"LOG_TIMESTAMP": true,
"ADMIN_EMAIL": "admin@example.com",
"AUTH_PROVIDERS": [
{
"name": "password",
"trusted": false
},
{
"name": "google",
"clientID": "your-google-client-id",
"trusted": true
}
],
"FEDERATION_TARGETS": [
{
"name": "Partner Instance",
"url": "https://karr.partner-example.com"
}
],
"DB_CONFIG": {
"host": "db",
"port": 5432,
"user": "karr_user",
"password_file": "/run/secrets/db-password",
"db_name": "karr_db",
"ssl": true
}
}
config/karr.config.json5
{
// add comments
"$schema": "https://karr.mobi/config.schema.json",
APPLICATION_NAME: "My Karr Instance",
APP_URL: "https://karr.example.com/",
API_PORT: 3000,
API_BASE: "/api",
LOG_LEVEL: "info",
LOG_TIMESTAMP: true,
ADMIN_EMAIL: "admin@example.com",
AUTH_PROVIDERS: [
{
// this is temporary
name: "password",
trusted: false,
},
{
name: "google",
clientID: "your-google-client-id",
trusted: true,
},
],
FEDERATION_TARGETS: [
{
name: "Partner Instance",
url: "https://karr.partner-example.com",
},
],
DB_CONFIG: {
host: "db",
port: 5432,
user: "karr_user",
password_file: "/run/secrets/db-password",
db_name: "karr_db",
ssl: true,
},
}