Pages

Configuration

Every setting lives in a typed config object that a *.config.php file returns. This page lists each object, its fields and their real defaults, and the environment variables the shipped config files read.

How config files are found

Tempest scans every discovery location (app/ and the framework package) for files ending in .config.php. Each file returns one object, and the container registers it as the instance of that class. Any service that takes BbsConfig $config in its constructor gets that object.

File Returns
app/Config/bbs.config.php Carrier\Config\BbsConfig
app/Config/servers.config.php Carrier\Config\ServersConfig
app/Config/doors.config.php Carrier\Door\DoorsConfig
app/Config/board.config.php App\Config\BoardConfig
app/Config/database.config.php Tempest\Database\Config\SQLiteConfig

When no file returns a config class, the container builds it from its constructor defaults. The framework ships no config files of its own, so the defaults below apply until the app overrides them.

Load order. When two files return the same class, the one loaded last wins. Tempest (LoadConfig.php) sorts files by suffix, then by path:

Priority (later wins) Suffix Loaded when ENVIRONMENT is
1 .config.php always
2 .staging.config.php, .stg.config.php staging
3 .production.config.php, .prod.config.php, .prd.config.php production
4 .dev.config.php, .local.config.php local
5 .test.config.php, .testing.config.php testing

So app/Config/bbs.local.config.php replaces bbs.config.php on a development machine without touching the shared file. Files under vendor/ load first and lose to anything in the app.

With CONFIG_CACHE on (the default when ENVIRONMENT=production), Tempest caches the list of config files in .carrier/cache/config; delete that directory after adding one. See deployment.

Environment variables

.env is read at boot. These are the variables the shipped config files and the logger read:

Variable Read by Default when unset
ENVIRONMENT Tempest — (.env.example sets local)
DISCOVERY_CACHE Tempest — (.env.example sets false)
LOG_LEVEL Logger.php info
BBS_NAME bbs.config.php The Neon Basement
BBS_SYSOP bbs.config.php Sysop
BBS_LOCATION bbs.config.php Somewhere on the net
BBS_TAGLINE bbs.config.php Est. 1994. Still online.
BBS_HOSTNAME bbs.config.php localhost
BBS_NODES bbs.config.php 16
BBS_THEME bbs.config.php default
TELNET_ADDRESS servers.config.php 0.0.0.0:2323
SSH_ADDRESS servers.config.php 0.0.0.0:2222
RLOGIN_ADDRESS servers.config.php 0.0.0.0:2513
WEB_ADDRESS servers.config.php 0.0.0.0:8080
DB_DATABASE database.config.php storage/carrier.sqlite

Set a listener address to off to disable that listener. A relative DB_DATABASE is resolved against the project root.

The defaults in this table belong to the app's config files and can differ from the class defaults below. BbsConfig::$name defaults to Carrier BBS, for example, but bbs.config.php falls back to The Neon Basement.

BbsConfig

Carrier\Config\BbsConfig, in BbsConfig.php. This object describes the board itself.

Field Type Default Used for
name string 'Carrier BBS' %BN / |BN, generated menu headers, the web page, the logoff line
sysop string 'Sysop' display codes, the web page, the seeded welcome message
location string '' %BL, System info, the web page
tagline string '' %BT, the web page, /api/status
hostname string 'localhost' the host shown with the telnet/SSH ports on the web page
nodes int 16 the most callers online at once; caller number nodes + 1 is told all nodes are busy
startMenu string 'matrix' the menu every connection starts in, after the pipeline
mainMenu string 'main' the name of the main menu
pipeline list<class-string> [BlockAddresses::class, DetectTerminal::class] steps each connection passes before startMenu (below)
blockedAddresses list<string> [] callers refused by BlockAddresses: exact IP, prefix*, or an IPv4 or IPv6 CIDR range
theme string 'default' the theme for callers who have not picked one (themes)
menuStyle string 'lightbar' 'lightbar' or 'hotkey', for menus and users that set none (menus)
idleTimeout int 600 seconds without a key before the caller is disconnected; 0 disables
requireAnsi bool false DetectTerminal refuses callers whose terminal does not answer the ANSI probe
newUserLevel int 20 security level of new accounts
sysopLevel int 255 accounts at or above this level are sysops (the SY ACS code)
levels array<int, SecurityLevel> see below level names and daily time allowances
dateFormat string 'Y-m-d' %DT, PHP date() format
timeFormat string 'H:i' %CT, PHP date() format
storagePath ?string root_path('storage') logs, SSH host keys, door drop files
resourcePath ?string root_path('resources') themes, art, bulletins

mainMenu is not read anywhere in the framework or app at the moment. The shipped menus reach main by forwarding from logon (Menus.php).

The first account created through the apply screen gets sysopLevel; later ones get newUserLevel (Apply.php).

Methods

Method Returns
level(int $securityLevel): SecurityLevel the entry with the highest key at or below $securityLevel; new SecurityLevel('User', 60) when no key matches
storage(string $path = ''): string storagePath joined with $path
resources(string $path = ''): string resourcePath joined with $path

Default levels

The class default:

levels: [
    0 => new SecurityLevel('Locked out', 5),
    10 => new SecurityLevel('Guest', 30),
    20 => new SecurityLevel('Caller', 90),
    100 => new SecurityLevel('Elite', 0),
    255 => new SecurityLevel('Sysop', 0),
],

The shipped bbs.config.php adds 50 => Regular (180) and 200 => Co-Sysop (0).

SecurityLevel

Carrier\Config\SecurityLevel, in SecurityLevel.php. Each entry is keyed in BbsConfig::$levels by the lowest security level it covers.

Field Type Meaning
name string shown in the user list, System info and %SD
minutes int daily time allowance; 0 = unlimited

Time is counted per calendar day. The menu runner warns at 5 minutes left and logs the caller off at 0 (MenuRunner.php). Doors with minMinutes refuse callers with less time left, and the drop file carries the minutes remaining.

ServersConfig

Carrier\Config\ServersConfig, in ServersConfig.php. This object holds the listener addresses. All listeners feed one node manager, so callers on different transports share one board.

Field Type Default Meaning
telnet ?string '0.0.0.0:2323' telnet listener; null disables it
ssh ?string '0.0.0.0:2222' SSH listener; null disables it
rlogin ?string '0.0.0.0:2513' rlogin listener; null disables it
web ?string '0.0.0.0:8080' HTTP + websocket listener; null disables it
sshGuestUsers list<string> ['new', 'guest', 'bbs'] SSH usernames let in without a password; they land at the matrix to apply or log in
sshBanner string '' text sent as the SSH auth banner before login
trustedProxies list<string> [] reverse proxies in front of the web listener (exact address, prefix* or CIDR). Only requests from these may set X-Forwarded-For and X-Forwarded-Proto; the board's config reads WEB_TRUSTED_PROXIES (comma-separated)
maxConnectionsPerAddress int 8 open connections one address may hold across all transports; 0 = no limit; the board's config reads MAX_CONNECTIONS_PER_ADDRESS
maxPendingSsh int 32 SSH connections that may be mid-handshake or unauthenticated at once; 0 = no limit
sshLoginGrace int 60 seconds an SSH client has to finish the handshake and authenticate
proxyProtocol list<string> [] listeners (telnet, ssh, rlogin) behind a TCP proxy that sends the PROXY protocol header (v1 or v2). On these the header is required and sets the caller's address; the board's config reads PROXY_PROTOCOL (comma-separated). See deployment

php carrier serve --telnet=… --ssh=… --rlogin=… --web=… overrides an address for one run. The values off, no, false and 0 disable a listener. See console and transports.

DoorsConfig

Carrier\Door\DoorsConfig, in DoorsConfig.php, has one field: doors, a list<DoorDefinition> defaulting to []. It lists external doors only. Native PHP doors are modules marked #[Door] and are discovered without an entry here.

DoorDefinition fields: name, title, description, acs, maxNodes, minMinutes, module, command, cwd, dropFile, commType, encoding, env, timeout, order. For their meaning, defaults and the command placeholders, see doors.

BoardConfig

App\Config\BoardConfig, in BoardConfig.php. It holds settings for the app's own modules, not the framework's. board.config.php returns new BoardConfig(), so every field is at its default.

Field Type Default Read by
newUsers bool true Apply: false closes new-user applications
handlePattern string (regex) '/^[A-Za-z0-9][A-Za-z0-9 _.\-]{1,23}$/' Apply: allowed handles
reservedHandles list<string> ['new', 'guest', 'bbs', 'sysop', 'all', 'system'] Apply: refused handles (case-insensitive)
newUserQuestions list<string> ['real_name', 'location'] Apply: extra questions, from real_name, location, email
minPasswordLength int 8 Apply
oneliners int 10 Oneliners: how many to show
onelinerLength int 64 Oneliners: maximum length
lastCallers int 10 Last callers: how many to show

To add a field, give BoardConfig a new constructor parameter, set it in board.config.php, and take BoardConfig in the constructor of the module that needs it.

SQLiteConfig

database.config.php returns Tempest's SQLiteConfig with path set from DB_DATABASE:

$path = env('DB_DATABASE', 'storage/carrier.sqlite');

return new SQLiteConfig(path: str_starts_with($path, '/') ? $path : root_path($path));

Other Tempest database configs can be returned instead. Only SQLite is set up and tested. See data.

The connection pipeline

BbsConfig::$pipeline lists the classes every connection passes through, in order, before it reaches startMenu. Each step is resolved from the container, so constructor injection works. A step's handle(Session $session, \Closure $next): mixed either calls $next($session) to continue or returns without calling it to hang up.

Step In What it does
Carrier\Session\Middleware\BlockAddresses framework Refuses addresses listed in blockedAddresses with "Access denied."
Carrier\Session\Middleware\DetectTerminal framework Probes the terminal for ANSI support, size, UTF-8 vs CP437 and CTerm. Refuses non-ANSI callers when requireAnsi is set.
App\Support\ShowConnectArt app Prints the CONNECT line and shows the connect art. Callers that the transport already logged in (SSH, rlogin) skip the pause.

The shipped bbs.config.php uses all three. Leave DetectTerminal in unless something else sets the terminal size and encoding: art placement and the character set depend on it.

Writing a step

<?php

declare(strict_types=1);

namespace App\Support;

use Carrier\Session\Session;

/** Close the board to everyone but the sysop's own network after midnight. */
final readonly class NightOwls
{
    public function handle(Session $session, \Closure $next): mixed
    {
        $local = str_starts_with($session->connection->remoteAddress(), '192.168.');

        if ((int) date('G') < 6 && ! $local) {
            $session->terminal->writeln("\r\n|12We're asleep. |07Call back after 6.|07");

            return null;
        }

        return $next($session);
    }
}

Add it to the list in bbs.config.php:

pipeline: [BlockAddresses::class, DetectTerminal::class, NightOwls::class, ShowConnectArt::class],

The step runs before login, so $session->user is still null. Run code after login with an #[EventHandler] for Carrier\Events\UserLoggedIn instead, as CallLog.php does. See architecture.