Playground (pgpg)

Configuration

pgpg reads its settings from a single TOML file, with environment variables available to override any value at runtime. This page covers the options that matter when running sandboxes.

Where the file lives

The configuration file is located at:

~/.config/rillence/config.toml

It is shared across Rillence tools. pgpg only reads the sections relevant to it; other tools ignore the rest.

Sample configuration

# License key (or set RILLENCE_LICENSE_KEY)
license_key = "rlc_xxxxxxxxxxxxxxxxxxxx"

[postgres]
# The PostgreSQL image and version used for every sandbox
image = "postgres"
version = "16"

[sandbox]
# Local TCP port range sandboxes are exposed on
port_range = "55432-55500"

[ai]
# Optional AI-assisted hints
enabled = true
provider = "anthropic"
api_key_env = "ANTHROPIC_API_KEY"

Pinning a PostgreSQL version

To reproduce behavior from a specific PostgreSQL major version, set version under [postgres]. The value is used as the image tag, so any tag the image publishes works:

[postgres]
image = "postgres"
version = "15"

To use a different image entirely (for example a flavor with extra extensions), change image as well. The next start boots a sandbox on that image.

Changing the port range

By default, sandboxes bind to a small range of local ports. If those ports conflict with other services, widen or move the range:

[sandbox]
port_range = "60000-60100"

pgpg picks the first free port in the range for each sandbox. The chosen port appears in the connection string printed at start.

AI hints

The [ai] section controls optional AI-assisted hints. Set enabled = true, pick a provider, and point api_key_env at the name of the environment variable that holds your API key — pgpg reads the key from that variable rather than storing it in the file.

Environment variable overrides

Any setting can be overridden at runtime with an environment variable prefixed RILLENCE_. Nested keys are joined with the section name. Environment variables take precedence over the file, which makes them handy for one-off runs and CI:

RILLENCE_POSTGRES_VERSION=15 pgpg
RILLENCE_SANDBOX_PORT_RANGE=60000-60100 pgpg
RILLENCE_LICENSE_KEY=rlc_xxxxxxxxxxxx pgpg

Common overrides:

  • RILLENCE_POSTGRES_IMAGE — the sandbox image.
  • RILLENCE_POSTGRES_VERSION — the image tag / PostgreSQL version.
  • RILLENCE_SANDBOX_PORT_RANGE — the local port range.
  • RILLENCE_LICENSE_KEY — your license key.

Precedence

Settings resolve in this order, highest first:

  1. Environment variables (RILLENCE_*)
  2. Config file (~/.config/rillence/config.toml)
  3. Built-in defaults

If you change the file while the REPL is running, restart pgpg to pick up the new values.