Skip to content

docs: Add documentation for the storage configuration block #24

@nstang43

Description

@nstang43

Description

The storage block is required in every Squadron configuration — omitting it produces:

Error: a storage block is required in the configuration, e.g.:

  storage {
    backend = "sqlite"
  }

However, there is no documentation for this block anywhere on the docs site. It's missing from:

  • config/overview.mdx — not listed in the Block Types table
  • No dedicated config/storage.mdx page exists
  • getting-started/quickstart.mdx — not mentioned
  • getting-started/docker.mdx — not mentioned

What the source code shows

From config/storage.go:

type StorageConfig struct {
    Backend    string `hcl:"backend,optional"`     // "sqlite" or "postgres"
    Path       string `hcl:"path,optional"`        // SQLite file path (default: ".squadron/store.db")
    ConnString string `hcl:"conn_string,optional"` // Postgres connection string
}

From store/factory.go, the two supported backends:

  • sqlite — requires path (defaults to .squadron/store.db, or $SQUADRON_HOME/store.db when SQUADRON_HOME is set)
  • postgres — requires conn_string (e.g., postgres://user:pass@host:5432/dbname). Uses pgx driver, auto-creates 12 tables via CREATE TABLE IF NOT EXISTS, sets pool to 25 max open / 5 max idle / 5min max lifetime.

Suggested documentation

Minimal addition to config/overview.mdx

Add storage to the Block Types table:

Block Purpose
storage Configure mission state persistence (SQLite or PostgreSQL)

New page: config/storage.mdx

SQLite (default):

storage {
  backend = "sqlite"
  path    = ".squadron/store.db"   # optional, this is the default
}

When SQUADRON_HOME is set, defaults to $SQUADRON_HOME/store.db.

PostgreSQL:

storage {
  backend     = "postgres"
  conn_string = "postgres://user:pass@localhost:5432/mydb"
}

Tables are auto-created on first use. Squadron creates 12 tables (missions, sessions, tool_results, etc.) using CREATE TABLE IF NOT EXISTS, so it can safely co-locate with application tables in the same database.

Attributes:

Attribute Type Default Description
backend string sqlite Storage backend: sqlite or postgres
path string .squadron/store.db SQLite database file path
conn_string string PostgreSQL connection string (required when backend = postgres)

Context

We discovered this through reading the source code after trial-and-error. Our project co-locates Squadron tables alongside application tables in the same Postgres database, which works well since there are no table name collisions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions