Configuration

The options you pass when opening a database, and the barrel_server app environment.

This lists the knobs you set when you open a database, and the settings the server reads from its app environment. Use it as a lookup; the guides explain when you would change each one.

Opening a database

barrel:open/2 takes options per layer:

{ok, Db} = barrel:open(mydb, #{
    vectordb => #{
        dimension => 768,        %% embedding dimension
        bm25_backend => memory   %% none (default) | memory | disk
    },
    embedding => #{provider => openai},   %% record mode: auto-embed on write
    encryption => default                 %% encrypt at rest with a provided key
}).
Layer / keyMeaning
vectordb.dimensionVector dimension (default 768).
vectordb.bm25_backendKeyword index: none, memory, or disk.
vectordb.hnsw_m, hnsw_ef_construction, hnsw_ef_searchHNSW index tuning.
embeddingAn embedding policy so documents auto-embed. See Record mode.
encryptiondisabled (default), default, or a provider spec. See Encryption.

Server configuration

barrel_server reads its settings from the barrel_server app environment (sys.config):

{barrel_server, [
    {http_port, 8080},
    {data_dir, "data"},
    {cors, #{origins => [<<"https://app.example">>]}},
    {auth, #{tokens => [<<"...">>]}},
    {mcp, #{enabled => true}}
]}.
KeyMeaning
http_portListen port (default 8080).
data_dirWhere databases are stored.
dbs_idle_timeout, dbs_max_openThe lifecycle manager: idle close and the open-handle LRU.
corsAllowed origins for browser clients (needed by barrel-lite).
authServer bearer tokens; capability tokens are issued per space.
mcpThe MCP endpoint: enabled, resources, live.

See Running the server for the full picture.