Installation instructions rely on default settings. Depending on your setup you might need to provide a custom config.
There are three areas where custom configuration can be provided:
- Dirac Agent
- Dirac nREPL middleware (a config inside nREPL server)
- Dirac Runtime (a page-specific config)
In general, a configuration can originate in different places:
- hard-coded defaults
- environment
- a config map provided as an argument to a function call
Configuration options from later override settings from previous.
Environmental variables have always a "DIRAC" prefix and are named after corresponding option key in the hard-coded defaults config map. We use the environ library for reading environmental settings, so you have multiple ways how to define them:
- environmental variables
- Java system properties
.lein-env
file.
You can for example use lein-environ
plugin to specify environmental variables directly in your project.clj
(or alternatively lein-boot
for boot scenario).
Please refer to environ docs for further info.
Please consult this file for possible defaults and their environmental counterparts.
If you call dirac.agent/boot!
from code,
you can override config options with a config map specified as an argument. Actually this is what
dirac.agent.cli
does by reading
command-line arguments and converting some of them to specific config keys.
Please consult this file for possible defaults and their environmental counterparts.
When you open/refresh Dirac DevTools it asks the current page for effective runtime page-specific config
(see dirac.runtime.repl/get-effective-config
.
The most important setting is the connection info for Dirac Agent. This allows flexibility of configuring individual
ClojureScript projects with their own settings instead of providing one system-wide configuration. In theory
you could have different projects connecting do different Dirac Agents (which are connected to different nREPL servers).
(ns your-project.namespace
(:require [dirac.runtime]))
(dirac.runtime/set-pref! :agent-host "1.2.3.4") ; an example of custom runtime configuration
(dirac.runtime/set-pref! :agent-port 9999) ; an example of custom runtime configuration
(dirac.runtime/install!) ; install must be called after configuration tweaks
Please consult this file for possible defaults and their environmental counterparts.
Please note that when installing Dirac runtime via :preloads
the config can be specified under :external-config > :dirac.runtime/config
.
This config example should be equivalent to the code above:
...
{:main my-project.main
:preloads [dirac.runtime.preload]
:external-config {:dirac.runtime/config {:agent-host "1.2.3.4"
:agent-port 9999}}}
...