Config file formats

Global config files

Place in the application working directory (or paths searched by generated GraftConfig.init()):

FileFormat
graftcode-config.jsonJSON
graftcode-config.yamlYAML
graftcode-config.txtKey-value text

JSON example

{
  "host": "tcp://gateway:8990"
}

YAML example

host: tcp://gateway:8990

Per-Graft config files

Replace {graft-name} with the package name (e.g. @graft/nuget-Orders@graft-nuget-Orders-config.json):

File pattern
{graft-name}-config.json
{graft-name}-config.yaml
{graft-name}-config.txt

Per-Graft config overrides global config for that Graft only.


Gateway CORS config (--corsConfig)

INI-style key=value file:

allowedOrigins=http://localhost:3000,https://app.example.com
allowedMethods=GET,POST,PUT,PATCH,DELETE,OPTIONS
allowedHeaders=content-type,authorization,MCP-Protocol-Version,Mcp-Session-Id
exposedHeaders=Mcp-Session-Id,MCP-Protocol-Version
allowCredentials=false

Alternative keys: origins, methods, headers, exposeHeaders, credentials.


Configuration precedence (Grafts)

Highest priority first:

  1. Runtime-specific environment variable
  2. Global environment variable
  3. Runtime-specific config file
  4. Global config file (graftcode-config.*)
  5. User code (GraftConfig.host, setConfig)
  6. Graft package default
  7. Hypertube default (in-memory)

See Runtime call execution.


See also