# Copy to `.env` for local development (do not commit `.env`). # First-party apps load `.env`, then evaluate `askdb.config.*` / `.config/askdb.*` (`@askdb/config`). # AskDB reads its settings from that config file, not from the environment: each variable below # matters only because the repo's askdb.config.ts reads it with env("…"). The one AskDB variable # read straight from the shell is ASKDB_DEBUG. # For an `askdb.config.ts` starter with example `.env` keys in comments, run: `pnpm exec askdb init` # ───────────────────────────────────────────────────────────────────────────── # AI provider (BYO LLM keys) # ───────────────────────────────────────────────────────────────────────────── # The repo's askdb.config.ts uses `ai.provider: "openai"`. It reads OPENAI_API_KEY into the # openai connection (`ai.providerConfig.openai.apiKey`) and OPENAI_MODEL into `ai.language.model`. # OPENAI_API_KEY=sk-... # OPENAI_MODEL=gpt-4o-mini # Also works for OpenRouter, Together, Groq, vLLM, LM Studio, llama.cpp server, Foundry's # `/openai/v1` inference route: anything that speaks the OpenAI REST protocol. The OpenAI SDK # reads OPENAI_BASE_URL itself. # OPENAI_BASE_URL= # e.g. https://api.openai.com/v1 (default) # To use another provider, set `ai.provider` in askdb.config.ts and give it a connection under # `ai.providerConfig`, reading each value with env("…"). These are the providers' usual names. # # Azure OpenAI / Microsoft Foundry (`ai.provider: "azure"`): the connection takes `apiKey` and # `resourceName` (the subdomain, e.g. "my-foundry" for https://my-foundry.openai.azure.com) or # `baseUrl`, plus `apiVersion`; `ai.language.model` is the *deployment* name. # AZURE_OPENAI_API_KEY= # AZURE_RESOURCE_NAME= # AZURE_OPENAI_BASE_URL=https://.../openai/deployments # instead of the resource name # AZURE_OPENAI_API_VERSION=2024-10-21 # AZURE_OPENAI_DEPLOYMENT= # # Google Gemini (`ai.provider: "google"`): # GOOGLE_GENERATIVE_AI_API_KEY= # GOOGLE_AI_MODEL=gemini-2.0-flash # or gemini-2.5-pro, etc. # ───────────────────────────────────────────────────────────────────────────── # Database (BYO — only required for live introspection) # ───────────────────────────────────────────────────────────────────────────── # The repo's askdb.config.ts reads DATABASE_URL for `introspection.providerConfig.postgres.databaseUrl` # and for Studio's Execute (`studio.execute.databaseUrl`). # For another engine, set `introspection.provider` to it and move the # `databaseUrl: env("DATABASE_URL")` line under that engine's providerConfig (SQLite takes # `file` instead). The values below connect to the multi-engine fixture (`pnpm fixture:up`). # # Postgres # DATABASE_URL=postgres://fixture_reader:fixture_reader@127.0.0.1:15432/askdb_fixture # MySQL (provider "mysql"; list more databases with `introspection.schemas`) # DATABASE_URL=mysql://fixture_reader:fixture_reader@127.0.0.1:13306/org # MariaDB (provider "mysql") # DATABASE_URL=mysql://fixture_reader:fixture_reader@127.0.0.1:13307/org # SQL Server (provider "sqlserver"; an mssql:// URL works too) # DATABASE_URL=Server=127.0.0.1,11433;Database=askdb_fixture;User Id=fixture_reader;Password=Fixture.Reader.2026;Encrypt=false;TrustServerCertificate=true # SQLite (provider "sqlite", `providerConfig.sqlite.file`; no URL): ./fixtures/multi-engine/.data/multi-engine.sqlite # ───────────────────────────────────────────────────────────────────────────── # RAG (optional) # ───────────────────────────────────────────────────────────────────────────── # The pgvector store's connection (`rag.storeConfig.pgvector.databaseUrl`), when `rag.store` is # "pgvector". Its index strategy is `rag.storeConfig.pgvector.indexStrategy` in askdb.config.ts # (ivfflat | hnsw | none, default hnsw). # ASKDB_PGVECTOR_URL=postgres://postgres:postgres@127.0.0.1:5434/askdb_rag # The embedding model. The repo's askdb.config.ts sets `rag.embedder: "ai"` and reads these into # `ai.embedding`, which embeds through the openai connection (OPENAI_API_KEY above). # Set `rag.embedder: "mock"` there for the local lexical embedder, which needs no key. # ASKDB_RAG_EMBEDDER_MODEL=text-embedding-3-small # ai.embedding.model (default in askdb.config.ts) # ASKDB_RAG_EMBEDDER_DIMENSIONS=1536 # ai.embedding.dimensions; optional: requests a size, else the model's own width # To embed with another provider (an Azure deployment, Gemini, …), set `ai.embedding.provider` # (and `connection` when it has several) in askdb.config.ts and give it a connection in `ai.providerConfig`. # ───────────────────────────────────────────────────────────────────────────── # Logs, modes, tests # ───────────────────────────────────────────────────────────────────────────── # The correlation id on every JSON log line (`logging.correlationId`). The log level is # `logging.level` in askdb.config.ts, or `--log-level` on the CLI. # ASKDB_CORRELATION_ID= # The operating mode is `modes.askdbMode` in askdb.config.ts (schema_only | bounded_results; # see docs/contracts/modes-v1.md). Omitting sensitive table/column *names* from NL→SQL DDL is # `modes.omitSensitiveFromPrompt: true` there (or `askdb ask --omit-sensitive-from-prompt`). # Fixed SQL instead of a model call, for tests and local runs (`dev.mockSql`). # ASKDB_MOCK_SQL=SELECT 1 # Print stack traces on errors. Read from the shell directly, not through askdb.config.ts. # ASKDB_DEBUG=1 # ───────────────────────────────────────────────────────────────────────────── # HTTP API and Studio (optional) # ───────────────────────────────────────────────────────────────────────────── # The HTTP API's default schema is `host.schemaPath` in askdb.config.ts (or `askdb-http --schema-path`). # The config reads HOST and PORT for `httpApi.listen`, and ASKDB_STUDIO_HOST and ASKDB_STUDIO_PORT # for `studio.listen`. # HOST=127.0.0.1 # PORT=3000 # ASKDB_STUDIO_HOST=127.0.0.1 # ASKDB_STUDIO_PORT=5556