Skip to content

runcobo.yml ​

runcobo.yml configures cobo's development commands. It lives in the project root, is read only by cobo — your running application never reads it — and must not contain production credentials.

runcobo.yml
yaml
name: blog
database_prefix: blog

seed_command: [crystal, run, src/seed.cr]
development_environment:
  HOST: "127.0.0.1"
  PORT: "3000"
secret_environment: SESSION_SECRET
public_base_environment: PUBLIC_BASE_URL

tasks:
  reindex:
    description: Rebuild the search index
    command: [crystal, run, src/jobs/reindex.cr, --]

Unknown keys are an error, so typos are caught immediately.

Required settings ​

KeyDescription
nameProject name
database_prefixLocal databases are named <prefix>_development and <prefix>_test. Lowercase letters, digits and _.

Local database ​

Only needed when your local server doesn't use the defaults. SQLite ignores both.

KeyDefaultDescription
database_userpostgres (PostgreSQL), root (MySQL)User for the local server
database_port5432 (PostgreSQL), 3306 (MySQL)Port of the local server

For a password or anything else, set a full URL in DEVELOPMENT_DATABASE_URL and TEST_DATABASE_URL — see Local databases.

Development server ​

KeyDefaultDescription
seed_commandnoneCommand run by cobo dev and cobo db seed
development_environment{}Variables for dev, console, runner and task. Values already set in your shell win.
secret_environmentnoneVariable name to fill with a random secret. Generated once and stored in .local/development-secret, so sessions survive restarts.
public_base_environmentnoneVariable name to fill with http://$HOST:$PORT, unless already set
application_entrysrc/app.crFile loaded by console and runner
tasks{}Named commands for cobo task — each with command (array) and optional description

Commands are arrays: each element is passed as one argument, with no shell expansion.

Database and code generation paths ​

All paths are relative to the project root.

KeyDefault
migration_directorydb/migrations
snapshot_pathdb/schema.snapshot.sql
generator_configsqlc.yaml
generator_inputs[db/migrations, db/queries]
generator_binarybin/crsql
generated_directorysrc/persistence/generated

If you change generator paths, keep sqlc.yaml consistent with them.

Environment variables ​

VariableUsed byDescription
DEVELOPMENT_DATABASE_URLlocal db commands, devOverride the development database. Must still be <prefix>_development on localhost/127.0.0.1.
TEST_DATABASE_URLlocal db commands, testSame, for <prefix>_test
STAGING_DATABASE_URLdb migrate/status/wait/rollback stagingStaging connection
PRODUCTION_DATABASE_URLdb migrate/status/wait productionProduction connection

cobo deliberately ignores DATABASE_URL when choosing a database, and strips connection-redirecting variables such as PGHOST, PGPORT, PGDATABASE and PGSERVICE. A stray variable in your shell can't point a destructive command at the wrong database.

Ignore local files ​

.gitignore
text
/.local/
/bin/
/db/schema.snapshot.sql

.local/ holds SQLite databases, the cobo dev build, the development secret and cached tools.

Released under the MIT License.