scaf.yaml
scaf.yaml
Section titled “scaf.yaml”scaf uses a .scaf.yaml configuration file in your project root.
Minimal Configuration
Section titled “Minimal Configuration”neo4j: uri: bolt://localhost:7687 username: neo4j password: passwordThe presence of a database key (like neo4j:) determines which database to use.
Full Configuration
Section titled “Full Configuration”# Neo4j database configurationneo4j: uri: bolt://localhost:7687 username: neo4j password: password database: neo4j # optional
# Code generation settingsgenerate: lang: go adapter: neogo # inferred from neo4j + go if not set out: ./generated package: queriesDatabase Configuration
Section titled “Database Configuration”Configure exactly one database. The database key determines the dialect automatically.
neo4j: # Connection URI (required) uri: bolt://localhost:7687
# Authentication username: neo4j password: password
# Target database (optional, defaults to neo4j) database: neo4jURI formats:
bolt://host:7687— Standard connectionneo4j://host:7687— Routing/cluster connectionbolt+s://host:7687— SSL encryptedneo4j+s://host:7687— SSL with routing
PostgreSQL (Coming Soon)
Section titled “PostgreSQL (Coming Soon)”postgres: # Individual fields host: localhost port: 5432 database: mydb user: postgres password: password sslmode: disable
# Or connection URI uri: postgres://user:pass@localhost:5432/mydb?sslmode=disableCode Generation
Section titled “Code Generation”Settings for scaf generate:
generate: # Target language (required for generate) lang: go
# Database adapter (usually inferred) adapter: neogo
# Output directory out: ./queries
# Go package name package: queriesAdapter Inference
Section titled “Adapter Inference”If adapter is not set, it’s inferred from the database and language:
| Database | Language | Default Adapter |
|---|---|---|
| neo4j | go | neogo |
| postgres | go | pgx |
| mysql | go | mysql |
| sqlite | go | sqlite |
Environment Variables
Section titled “Environment Variables”Override config with environment variables:
| Variable | Description |
|---|---|
SCAF_URI | Database URI |
SCAF_USER | Database username |
SCAF_PASS | Database password |
SCAF_PASS=secret scaf testCommand-line flags also override config:
scaf test --uri bolt://localhost:7687 --username neo4j --password secretConfig File Location
Section titled “Config File Location”scaf looks for configuration in order:
.scaf.yamlin current directory.scaf.ymlin current directoryscaf.yamlin current directoryscaf.ymlin current directory- Same patterns in parent directories (up to filesystem root)
Example Configurations
Section titled “Example Configurations”Neo4j Local Development
Section titled “Neo4j Local Development”neo4j: uri: bolt://localhost:7687 username: neo4j password: password
generate: lang: go out: ./internal/queries package: queriesPostgreSQL with Docker
Section titled “PostgreSQL with Docker”postgres: host: localhost port: 5432 database: testdb user: postgres password: postgres sslmode: disable
generate: lang: go adapter: pgxCI/CD Configuration
Section titled “CI/CD Configuration”Use environment variables for secrets:
neo4j: uri: ${NEO4J_URI:-bolt://localhost:7687} username: ${NEO4J_USER:-neo4j} password: ${NEO4J_PASSWORD}# In CIexport NEO4J_URI=bolt://neo4j-service:7687export NEO4J_USER=neo4jexport NEO4J_PASSWORD=$SECRET_PASSWORDscaf testOr use flags:
scaf test \ --uri "$NEO4J_URI" \ --username "$NEO4J_USER" \ --password "$NEO4J_PASSWORD"