Skip to content

feat(container-config): DB-backed env + blocked_hosts for ContainerConfig#2709

Open
markbala wants to merge 1 commit into
nanocoai:mainfrom
markbala:feat/container-env-blocked-hosts
Open

feat(container-config): DB-backed env + blocked_hosts for ContainerConfig#2709
markbala wants to merge 1 commit into
nanocoai:mainfrom
markbala:feat/container-env-blocked-hosts

Conversation

@markbala

@markbala markbala commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Type of Change

Implements maintainer-filed #1867 (a source-level enhancement the maintainers requested).

Description

What. Adds two DB-backed JSON columns to container_configsenv (Record<string,string>) and blocked_hosts (string[]) — materialised into container.json and applied at container spawn:

  • env → injected as -e KEY=VALUE, after the OneCLI gateway so config vars win (e.g. overriding ANTHROPIC_BASE_URL).
  • blocked_hosts → each mapped to 0.0.0.0 via --add-host.

Why. Lets an agent group be routed to a local OpenAI/Anthropic-compatible endpoint and hardened against silent cloud fallback without editing source — the infra #1859 (/add-ollama-provider) documented as a deferred prerequisite, so that skill's redirect survives the DB→container.json materialise instead of being wiped on each spawn. Closes #1867.

How. Stored as JSON columns alongside skills / mcp_servers / additional_mounts for consistency. Migration 016 adds the columns; configFromDb parses them; backfill carries any legacy container.json values in. Managed via ncl groups config set-env / block-host / unblock-host; config get shows both. (#1859's third prereq, the Dockerfile chmod, is an independent concern — out of scope.)

Tested. tsc clean; pnpm test 335 passing (3 new in container-configs.test.ts). Validated live: an agent group pointed at a local Ollama endpoint via env.ANTHROPIC_BASE_URL with api.anthropic.com blocked — docker inspect confirms the -e vars + ExtraHosts: api.anthropic.com:0.0.0.0, the agent replies via the local model, and the config survives respawns.

…nfig

Add two DB-backed JSON columns to container_configs, materialized into
container.json and applied at container spawn:

- env: extra env vars injected as -e KEY=VALUE (applied after the OneCLI
  gateway so they win over its injected vars, e.g. ANTHROPIC_BASE_URL).
- blocked_hosts: hosts mapped to 0.0.0.0 via --add-host.

Together these let an agent group be routed to a local OpenAI/Anthropic-
compatible endpoint and hardened against silent cloud fallback (block
api.anthropic.com) without editing source — the infra the
/add-ollama-provider skill (nanocoai#1859) documented as a deferred prerequisite.

Stored as JSON columns alongside skills/mcp_servers/additional_mounts so
they survive materializeContainerJson and are managed via ncl
(groups config set-env / block-host / unblock-host).

Closes nanocoai#1867.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follows-guidelines PR was created using the current contributing template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: allow ContainerConfig to pass custom env vars to containers

1 participant