Karafka's behavior can be altered with the following environment variables:
Name Description
KARAFKA_ROOT_DIR Root dir of the Karafka application. Defaults to the directory of the outermost Gemfile as resolved by Bundler (Bundler.default_gemfile), not the BUNDLE_GEMFILE env variable directly, since that can be altered by tools like ruby-lsp
KARAFKA_ENV Karafka app expected environment. If not defined, autodetected based on RACK_ENV, RAILS_ENV (in that priority order) with a fallback to development.
KARAFKA_BOOT_FILE Location of Karafka boot file (karafka.rb) or false. Defaults to karafka.rb in the project root directory. May be set to false in case you want to fully control Karafka boot process.
KARAFKA_REQUIRE_RAILS Determines if Rails should be required when present in the Gemfile. If set to false, Karafka can run without Rails even if both are in the same Gemfile.
## See Also - [Configuration](https://karafka.io/docs/Basics-Configuration.md) - Complete configuration reference - [Deployment](https://karafka.io/docs/Infrastructure-Deployment.md) - Using environment variables in deployment - [Development vs Production](https://karafka.io/docs/Infrastructure-Application-Development-vs-Production.md) - Environment-specific settings --- *Last modified: 2026-08-12 09:56:38*