Skip to content

Configuration

Every option in tDB's config.lua, with its type and default, plus the superuser, backup, S3 and remote-instance blocks.

Everything lives in config.lua, in the resource folder. Most servers change nothing.

Where a credential comes from

Every credential-shaped key in config.lua ships blank and should stay blank, so the file is safe to commit and safe to paste. Three places supply a real value, first one set wins:

WhereSet it by
1a server convarset tdb_superuser_password "…" in server.cfg
2config.local.luaediting that file; it is gitignored and never packaged
3config.luanothing — it ships blank and stays blank

The convar name is tdb_, then the option's path with dots as underscores, lowercased: Config.Superuser.Password is tdb_superuser_password, Config.Advanced.S3.SecretKey is tdb_advanced_s3_secretkey.

A convar overrides a password tDB generated earlier.

config.local.lua is where tDB stores the password it generates, and is also yours to edit. It uses config.lua syntax and needs only the keys you override:

lua
Config = Config or {}

Config.Superuser = {
    Email = "admin@localhost.local",
    Password = "…",
}

Top level

OptionTypeDefaultDescription
Config.ExposeAdminbooleantruePublish the admin UI at /db/_/ on tLib's port. false keeps the database headless and unreachable from outside the machine
Config.ShowInHubbooleantrueList the admin UI in tLib's hub. Cosmetic only, not a security control
Config.DebugbooleanfalsePrint tDB's debug lines. Off, a normal boot prints the startup box and nothing else
Config.AutoUpdatebooleanfalseRun pocketbase update on start, replacing the shipped build with an unverified newer one under a live database

The admin UI

On by default and needs no configuration. It is at http://<your server>:7777/db/, the panel itself at /db/_/; sign in with Config.Superuser. For a headless database, set Config.ExposeAdmin = false.

The panel answers on tLib's tlib_http_port (default 7777) and the address handed out is tlib_http_public_url — both in tLib's convar reference. That is the only port you ever set: PocketBase's own is internal, so do not open or forward it.

If the startup box says Waiting for tLib's HTTP listener, tLib's router is not up yet and tDB publishes the admin URL as soon as it is. The database itself works throughout.

Superuser

lua
Config.Superuser = { Email = "", Password = "" }

Leave these blank. To pin a login you already have:

txt
set tdb_superuser_email "admin@example.com"
set tdb_superuser_password "…"

With neither convar set, tDB generates both on first start and writes them into config.local.lua. The generated password prints in the console once, on the run that creates it, and is redacted on every start after.

Backups

lua
Config.Backup = {
    Enabled = false,
    OnStartup = true,
    ScheduleSeconds = 0,
    KeepLast = 7,
    BackupPrefix = "auto_",
}
OptionTypeDefaultDescription
EnabledbooleanfalseMaster switch for automatic backups
OnStartupbooleantrueBack up before each start
ScheduleSecondsnumber0Seconds between backups. 0 disables the timer. Renamed from Schedule in 1.0; the old name works and warns until 2.0
KeepLastnumber7How many automatic backups to retain. 0 keeps all
BackupPrefixstring"auto_"Prefix identifying tDB's own backups, so manual ones are never pruned

Backups land in the PocketBase data directory under backups.

SQL imports

lua
Config.Sql = { Enabled = true, Dir = "sql", OnChanged = "warn" }
OptionTypeDefaultDescription
EnabledbooleantrueApply .sql files from Dir on startup
Dirstring"sql"Relative to the resource, or an absolute path
OnChangedstring"warn"What to do when a file changes after it was applied: "warn", "error" or "apply"

warn and error differ only in log level and neither re-runs the file. apply re-runs it, replaying every INSERT it contains, so it suits pure DDL dumps only. Full behaviour is on Importing .sql files.

Migrations

lua
Config.Migrations = { AutoApply = true, Dir = ".runtime/pb_migrations" }

PocketBase's own collection migrations, not the .sql drop folder. A migration file is written whenever you change a collection in the admin UI, so schema changes travel with the resource.

Advanced

lua
Config.Advanced = {
    RemoteHost = "",
    RemotePort = "",
    Dev = false,
    AutoMigrate = true,
    PublicDir = "pb_public",
    DataDir = ".runtime/pb_data",
}
OptionTypeDefaultDescription
RemoteHoststring""Hostname of a PocketBase you already run. See Local or remote
RemotePortstring""Port of that instance. Both must be set together
DevbooleanfalseRun PocketBase with verbose logging
AutoMigratebooleantrueLet PocketBase write a migration when a collection changes
PublicDirstring"pb_public"Directory served as static files, relative to the resource
DataDirstring".runtime/pb_data"Where the database and backups live, relative to the resource

Local or remote

By default tDB starts and manages its own PocketBase on 127.0.0.1. To point it at an instance you already run, set both keys:

lua
Config.Advanced = { RemoteHost = "db.example.com", RemotePort = "8090" }

In remote mode no local process starts, and Migrations, Backup and S3 are ignored.

Mail

Mail is configured in the PocketBase admin UI, under Settings → Mail. There is no SMTP block in config.lua.

S3

lua
Config.Advanced = {
    S3 = {
        Manage = false, Enabled = false,
        Bucket = "", Region = "", Endpoint = "",
        AccessKey = "", SecretKey = "", ForcePathStyle = false,
    },
}

Manage decides who owns the setting:

StateBehaviour
Manage = false (default)tDB never touches it. Set it in the admin UI and it stays as you left it. Everything else in the block is ignored
Manage = true, Enabled = trueconfig.lua is the truth. Every field is applied on every start, secrets included. An admin-UI edit is reported, then overwritten
Manage = true, Enabled = falseconfig.lua is still the truth, and the truth is "off". Genuinely disables it

Hiding it from the hub

lua
Config.ShowInHub = false   -- default: true

Still stuck? Support can answer it directly.

Was this page helpful?