agent/php/config.php
Snider 4e190dc7ec fix(brain): Postgres portability for brain connection + migrations
Three related fixes so the brain DB works on Postgres, not just MariaDB:

1. config.php — brain charset/collation was hardcoded to utf8mb4 which
   Postgres rejects as client_encoding. Now driver-aware: utf8 for
   pgsql, utf8mb4 otherwise. Override via BRAIN_DB_CHARSET env var.

2. Migration 000008 (create_brain_memories) — self-referential FK on
   supersedes_id was declared inside Schema::create{}, causing Postgres
   to evaluate it before the PK index existed ('no unique constraint
   matching given keys'). Split into Schema::create + separate
   Schema::table to guarantee PK is in place when FK is added.

3. Migration 000009 (drop workspace FK) — try/catch inside the Blueprint
   closure couldn't catch deferred SQL failures. Replaced with a
   constraint-exists pre-query against information_schema, supporting
   both pgsql and mariadb/mysql drivers. Fresh installs no longer fail
   trying to drop a constraint that was never created.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-23 12:32:58 +01:00

107 lines
4 KiB
PHP

<?php
return [
/*
|--------------------------------------------------------------------------
| MCP Portal Domain
|--------------------------------------------------------------------------
|
| Default domain for the MCP Portal. The app-level Boot may override this
| with a wildcard (e.g. mcp.{tld}) for multi-domain support.
|
*/
'domain' => env('MCP_DOMAIN', 'mcp.'.env('APP_DOMAIN', 'host.uk.com')),
/*
|--------------------------------------------------------------------------
| Registry Path
|--------------------------------------------------------------------------
|
| Where to find MCP server definitions. Each server has its own YAML file
| in the servers subdirectory.
|
*/
'registry_path' => resource_path('mcp'),
/*
|--------------------------------------------------------------------------
| Plan Templates Path
|--------------------------------------------------------------------------
|
| Where agent plan templates are stored. These define structured workflows
| for common development tasks.
|
*/
'templates_path' => resource_path('plan-templates'),
/*
|--------------------------------------------------------------------------
| Content Generation Paths
|--------------------------------------------------------------------------
|
| Paths for the ContentService batch generation system.
|
*/
'content' => [
'batch_path' => 'app/Mod/Agentic/Resources/tasks',
'prompt_path' => 'app/Mod/Agentic/Resources/prompts/content',
'drafts_path' => 'app/Mod/Agentic/Resources/drafts',
],
/*
|--------------------------------------------------------------------------
| Cache Keys
|--------------------------------------------------------------------------
|
| Namespaced cache keys used by agentic endpoints. Override these in your
| application config to prevent collisions with other modules.
|
*/
'cache' => [
'for_agents_key' => 'agentic.for-agents.json',
'for_agents_ttl' => 3600,
],
/*
|--------------------------------------------------------------------------
| OpenBrain (Shared Agent Knowledge Store)
|--------------------------------------------------------------------------
|
| Configuration for the vector-indexed knowledge store. Requires
| Ollama (for embeddings) and Qdrant (for vector search).
|
*/
'brain' => [
'ollama_url' => env('BRAIN_OLLAMA_URL', 'https://ollama.lthn.sh'),
'qdrant_url' => env('BRAIN_QDRANT_URL', 'https://qdrant.lthn.sh'),
'collection' => env('BRAIN_COLLECTION', 'openbrain'),
'embedding_model' => env('BRAIN_EMBEDDING_MODEL', 'embeddinggemma'),
// Dedicated database connection for brain_memories.
// Defaults to the app's main database when BRAIN_DB_* env vars are absent.
// Set BRAIN_DB_HOST to a remote MariaDB (e.g. the homelab) to co-locate
// DB rows with their Qdrant vectors.
'database' => [
'driver' => env('BRAIN_DB_DRIVER', env('DB_CONNECTION', 'mariadb')),
'host' => env('BRAIN_DB_HOST', env('DB_HOST', '127.0.0.1')),
'port' => env('BRAIN_DB_PORT', env('DB_PORT', '3306')),
'database' => env('BRAIN_DB_DATABASE', env('DB_DATABASE', 'forge')),
'username' => env('BRAIN_DB_USERNAME', env('DB_USERNAME', 'forge')),
'password' => env('BRAIN_DB_PASSWORD', env('DB_PASSWORD', '')),
// charset defaults: utf8 for pgsql (Postgres rejects 'utf8mb4'),
// utf8mb4 for everything else (MariaDB/MySQL). Override with
// BRAIN_DB_CHARSET if your instance needs something specific.
'charset' => env('BRAIN_DB_CHARSET', env('BRAIN_DB_DRIVER', env('DB_CONNECTION', 'mariadb')) === 'pgsql' ? 'utf8' : 'utf8mb4'),
'collation' => env('BRAIN_DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
],
],
];