📚 Context
The rollups node supports fine-grained configuration through environment variables that the CLI does not expose as flags. For example, CARTESI_LOG_LEVEL_JSONRPC_API controls the log level of the JSON-RPC API subsystem independently of the global CARTESI_LOG_LEVEL.
Today there is no way to set such a variable through the CLI. Defining it in the shell when running cartesi run has no effect:
CARTESI_LOG_LEVEL_JSONRPC_API=debug cartesi run
# variable is not present in the rollups_node container
The reason is that the environment passed to docker compose (in startEnvironment at apps/cli/src/exec/rollups.ts) only reaches the compose client process — execa already merges process.env by default (extendEnv: true). Docker Compose does not forward its own process environment into containers: a container's environment comes solely from the environment: / env_file: sections of the compose file. The host-side environment is only used for ${VAR} interpolation in the YAML and for valueless passthrough keys (e.g. - FOO). The compose services generated by the CLI (e.g. apps/cli/src/compose/node.ts) define fully literal environment: maps, with no interpolation and no passthrough keys — so nothing from the user's shell can reach the containers.
✔️ Solution
Possible approaches (not mutually exclusive):
- Prefix passthrough: in
startEnvironment, collect all CARTESI_* variables from process.env and inject them into the rollups_node service environment: section.
- Benefit: zero ceremony, works for any current and future node variable.
- Drawback: ambient shell variables silently affect the node; precedence must be defined (should a shell
CARTESI_LOG_LEVEL override the value derived from --verbose?).
- Explicit flag: add
--env KEY=VALUE (repeatable) to cartesi run.
- Benefit: explicit and discoverable, no ambient-environment surprises.
- Drawback: more typing for something the user already expressed as an env var.
- Project config: support an env section in
cartesi.toml for persistent per-project node configuration.
- Benefit: declarative and versionable.
- Drawback: not suited for one-off overrides.
📈 Subtasks
🎯 Definition of Done
📚 Context
The rollups node supports fine-grained configuration through environment variables that the CLI does not expose as flags. For example,
CARTESI_LOG_LEVEL_JSONRPC_APIcontrols the log level of the JSON-RPC API subsystem independently of the globalCARTESI_LOG_LEVEL.Today there is no way to set such a variable through the CLI. Defining it in the shell when running
cartesi runhas no effect:CARTESI_LOG_LEVEL_JSONRPC_API=debug cartesi run # variable is not present in the rollups_node containerThe reason is that the environment passed to
docker compose(instartEnvironmentatapps/cli/src/exec/rollups.ts) only reaches the compose client process — execa already mergesprocess.envby default (extendEnv: true). Docker Compose does not forward its own process environment into containers: a container's environment comes solely from theenvironment:/env_file:sections of the compose file. The host-side environment is only used for${VAR}interpolation in the YAML and for valueless passthrough keys (e.g.- FOO). The compose services generated by the CLI (e.g.apps/cli/src/compose/node.ts) define fully literalenvironment:maps, with no interpolation and no passthrough keys — so nothing from the user's shell can reach the containers.✔️ Solution
Possible approaches (not mutually exclusive):
startEnvironment, collect allCARTESI_*variables fromprocess.envand inject them into therollups_nodeserviceenvironment:section.CARTESI_LOG_LEVELoverride the value derived from--verbose?).--env KEY=VALUE(repeatable) tocartesi run.cartesi.tomlfor persistent per-project node configuration.📈 Subtasks
startEnvironment/ compose generation--dry-runconfig)🎯 Definition of Done
CARTESI_LOG_LEVEL_JSONRPC_API=debug cartesi run(or the equivalent flag/config) results in the variable being set inside therollups_nodecontainer