Skip to main content

Environment Variables

For settings that can be managed with Instance Settings, you can either set the values via environment variables or through the Instance Settings page in your instance. However, it is strongly recommended to use Instance settings. Environment variables are only loaded when there are no values in Instance settings, which means that environment variables could reflect outdated values.

For other settings, there are various environment variables you can set to configure your instance. Below is a comprehensive list of all of them.

karrio server is a Django based project and most of deployment settings are relevant to configure this project with few contextual naming differences.

Karrio Server

DEPLOYMENT

  • KARRIO_HOST | default: localhost

The karrio server hostname

  • KARRIO_PORT | default: 5002

The karrio server port

  • KARRIO_WORKERS | default: 2

The number of parallel subprocesses for the karrio server

  • DETACHED_WORKER | [True, False] | default: False

Indicate whether the karrio server process should be detached from the background worker process.

caution

Setting this option to True means that you intend to run the background worker process in another container or another runtime resource.

  • BACKGROUND_WORKERS | default: 2

The number of parallel subprocesses for the karrio server background worker

  • DEBUG_MODE | [True, False] | default: False

It is important to set DEBUG_MODE to False in production for security and performance.

note

Is the equivalent of django's DEBUG flag.

  • ALLOWED_HOSTS

Set a list of authorized host in text separated by commas.

e.g: "test.com,example.com"

  • SECRET_KEY

The secret key must be a unique large value for security reason.

Is the equivalent of django's SECRET_KEY flag.

  • USE_HTTPS | [True, False] | default: False

You should set USE_HTTPS to True when you configure your system in production with SSL.

  • TRACKING_PULSE | default: 7200

The background tracking time interval in seconds. The default is of 2 hours. You can set it to a lower value if you want a more frequent tracking status update.


CACHING

  • REDIS_HOST

The redis host name or IP address.

  • REDIS_PORT

The redis instance port.

  • REDIS_PREFIX | default: karrio

The redis key prefix.


PROVISIONING

  • ADMIN_EMAIL | default: admin@example.com

The default super user admin account email to add when the system start for the first time

  • ADMIN_PASSWORD | default: demo

The default super user password

caution

Make sure to change the password later


LOGGING

  • LOG_LEVEL | [DEBUG, INFO, WARNING, ERROR, CRITICAL]

The default value is DEBUG when DEBUG_MODE is True else INFO

  • LOG_DIR

Is the log file location.

  • WORKER_DB_DIR

The karrio server background worker persists events to process so that even after a shutdown, they can recover tasks and process them.

tip

When you are using a container, you might want to mount this folder on a volume so that they can be recovered when the container shuts down.


DATABASE

Karrio uses PostgresSQL as a database.

  • DATABASE_HOST | default: db

The database host

the database host can be an IP address or a hostname

  • DATABASE_PORT | default: 5432

The database port

  • DATABASE_NAME | default: db

The database name

  • DATABASE_USERNAME | default: postgres

The database connection' user

  • DATABASE_PASSWORD | default: postgres

The database connection' password

  • DATABASE_ENGINE | [postgresql, sqlite3, mysql, oracle] | default: postgresql

The database backend to use.

  • DATABASE_CONN_MAX_AGE | default: 0

The lifetime of a database connection. Use 0 to close database connections at the end of each request

Or connection URL

  • DATABASE_URL
Connection string
postgresql://postgres:postgres@localhost:5432/karriodb?schema=public

EMAIL

  • EMAIL_USE_TLS | default: False

The email server use TLS

  • EMAIL_HOST_USER | default: False

The authentication user email

  • EMAIL_HOST_PASSWORD

The authentication user password

  • EMAIL_HOST | default: smtp.gmail.com

The email server host

  • EMAIL_PORT | default: 587

The email server use TLS

  • EMAIL_FROM_ADDRESS | default: noreply@karrio.io

The email address to send emails from


APM

Karrio support Sentry and [PostHog] for APM and product analytics.

Sentry

  • SENTRY_DSN

PostHog

  • POSTHOG_KEY
  • POSTHOG_HOST | default: https://app.posthog.com

Rate Limiting

Karrio uses Django REST framework's throttling system to control API request rates. You can customize these limits using the following environment variables:

  • ANON_RATE_LIMIT | default: 60/minute

The rate limit for anonymous users. Format should be "number/period" where period can be second, minute, hour or day.

  • USER_RATE_LIMIT | default: 600/minute

The rate limit for authenticated users. Uses the same format as ANON_RATE_LIMIT.

  • CARRIER_REQUEST_RATE_LIMIT | default: 300/minute

The rate limit for carrier-specific API requests. Uses the same format as ANON_RATE_LIMIT.

Example configuration:

Karrio Dashboard

  • NEXT_PUBLIC_KARRIO_PUBLIC_URL | required

The URL of the Karrio Server. KARRIO_PUBLIC_URL was deprecated in favor of NEXT_PUBLIC_KARRIO_PUBLIC_URL.

Auth requirements

  • NEXT_PUBLIC_DASHBOARD_URL | required

The URL of the Karrio Dashboard for auth redirection. DASHBOARD_URL was deprecated in favor of NEXT_PUBLIC_DASHBOARD_URL.

  • NEXTAUTH_SECRET | required

The environment secret encryption key for JWT.

JWT Configuration

  • JWT_ACCESS_EXPIRY | default: 30

The JWT access token expiry time in minutes.

  • JWT_REFRESH_EXPIRY | default: 3

The JWT refresh token expiry time in days.

  • JWT_SECRET | required

The secret key used for JWT token encryption. Should be at least 32 characters long.

Redis Configuration

  • REDIS_HOST | default: redis

The Redis server host.

  • REDIS_PORT | default: 6379

The Redis server port.

  • REDIS_PASSWORD | optional

The Redis server password if authentication is required.

Logging

  • LOG_LEVEL | default: INFO

The logging level for Karrio services. Valid values are: DEBUG, INFO, WARNING, ERROR, CRITICAL.

  • DJANGO_LOG_LEVEL | default: WARNING

The logging level for Django framework. Uses same values as LOG_LEVEL.

  • LOG_DIR | default: WORK_DIR

The directory where log files will be stored.

Feature Flags

  • ALLOW_SIGNUP | default: false

Enable or disable user registration.

  • ALLOW_ADMIN_APPROVED_SIGNUP | default: false

Enable or disable admin approval requirement for new user registrations.

  • ALLOW_MULTI_ACCOUNT | default: false

Enable or disable multiple account support.

  • PERSIST_SDK_TRACING | default: true

Enable or disable persistent storage of SDK tracing information.