Forum teuk.org

Cleaner Configs, Safer Defaults, and Better Install Documentation

in Mediabot · started by TeuK · 1w ago

TeuK · 1w ago

Cleaner Configs, Safer Defaults, and Better Install Documentation

Suggested forum title

Mediabot v3: cleaner configs, safer defaults, and a much clearer Debian 13 install path

Article

This update is another cleanup and reliability pass for Mediabot v3. The main goal was simple: make the project easier to install, easier to understand, and harder to misconfigure.

A lot of the recent work focused on keeping the runtime code, sample configuration, live test configuration, installer scripts, and README aligned with each other.

Configuration cleanup

The official sample configuration is now treated as a single root-level file:

mediabot.sample.conf

The README and sample references now follow that rule consistently.

Several configuration keys were cleaned up or normalized so that new installs do not inherit confusing or unsafe defaults.

Notable examples:

CONN_PASS=
CONN_BIND_IP=
CHARSET_MODE=utf8mb4
DCC_DEBUG_HINTS=0
PARTYLINE_EVAL_ENABLED=0
PARTYLINE_EVAL_TIMEOUT_SECONDS=5

CONN_BIND_IP is now empty by default, with the documentation example kept commented. This avoids the bad situation where someone copies a sample config and accidentally tries to bind to a non-local placeholder IP.

API keys in the sample config are now empty by default instead of using fake active-looking placeholders:

[openai]
API_KEY=

[fortnite]
API_KEY=

[tmdb]
API_KEY=

This is cleaner and safer for users who copy the sample as a starting point.

Radio configuration cleanup

The old active radio and Liquidsoap keys were removed from the official sample and live test template where they no longer match the current Mediabot radio commands.

The modern radio configuration now focuses on the Icecast JSON status flow:

[radio]
YOUTUBEDL_INCOMING=/home/mediabot/mediabot_v3/mp3
YTDLP_PATH=/usr/local/bin/yt-dlp

RADIO_ICECAST_STATUS_BASE_URL=http://127.0.0.1:8000
RADIO_ICECAST_PUBLIC_BASE_URL=http://example.com:8000
RADIO_ICECAST_TIMEOUT=5
RADIO_ICECAST_PRIMARY_MOUNT=/radio160.mp3

This makes the sample, live test config, and README tell the same story.

Libera NickServ naming

The old historical network naming was cleaned up in the important configuration path.

The current configuration now uses:

[libera]
LIBERA_NICKSERV_PASSWORD=

Network type 2 is documented as Libera-style NickServ authentication. Installer prompts, generated config, sample config, and tests now follow that naming consistently.

Partyline eval safety

.eval is now safer by default.

Owner level is still required, but it is no longer enough by itself. The command must also be explicitly enabled:

PARTYLINE_EVAL_ENABLED=1

By default, the sample keeps it disabled:

PARTYLINE_EVAL_ENABLED=0
PARTYLINE_EVAL_TIMEOUT_SECONDS=5

This makes the dangerous command opt-in instead of merely permission-protected.

Installer and generated config improvements

The generated configuration path was brought closer to the modern sample config.

The installer and related generation flow now account for more runtime keys, including optional connection values and safer defaults.

A small bug was also fixed in the interactive configure script: addIrcServer() now logs the real server hostname argument instead of relying on a global prompt variable.

README installation guide

The README received a major practical improvement.

The Debian 13 quick install section is now much more explicit. It walks through:

  • bootstrapping the system;
  • creating the mediabot user;
  • using temporary sudo safely;
  • downloading the stable release or development tree;
  • creating the MariaDB database;
  • running ./configure;
  • reviewing mediabot.conf;
  • starting the bot in foreground first;
  • registering the first owner from IRC;
  • connecting to Partyline;
  • removing temporary sudo access;
  • checking common startup problems.

The configuration examples were also corrected to use the real Mediabot sections:

[mysql]
MAIN_PROG_DBHOST=localhost
MAIN_PROG_DBPORT=3306
MAIN_PROG_DDBNAME=mediabot
MAIN_PROG_DBUSER=mediabot
MAIN_PROG_DBPASS=change-this-password
CHARSET_MODE=utf8mb4

[connection]
CONN_SERVER_NETWORK=irc.example.net
CONN_NICK=mediabot
CONN_USERNAME=mediabot
CONN_IRCNAME=Mediabot v3
CONN_USERMODE=+iw
CONN_NETWORK_TYPE=1
CONN_PASS=
CONN_BIND_IP=

The goal is that new users should not have to guess the real config format.

Test coverage

More regression tests were added to protect the cleanup work.

The tests now cover areas such as:

  • live test config alignment;
  • modern radio keys;
  • removal of legacy active radio keys;
  • duplicate config keys in the sample;
  • optional connection defaults;
  • generated config keys;
  • stale/dead config key removal;
  • empty API key defaults;
  • README sample paths and command syntax;
  • README examples using real config sections.

This matters because config drift is easy to reintroduce. These tests make sure the README, sample config, live test template, installer scripts, and runtime code stay closer together.

Why this matters

This is not a flashy feature update, but it is an important maintenance update.

A bot project becomes much easier to trust when:

  • sample configs are safe to copy;
  • README commands are actually copy/pasteable;
  • generated configs match runtime expectations;
  • dangerous commands are disabled unless explicitly enabled;
  • obsolete keys disappear instead of lingering forever;
  • tests protect these assumptions.

In short: fewer traps for new users, fewer stale ghosts in the config, and a cleaner foundation for the next Mediabot v3 work.

Suggested commit message

Mischief Managed: cleanse stale config charms and illuminate the install path

Full local validation

cd /home/mediabot/mediabot_v3 || exit 1

find Mediabot -name '*.pm' -print0 | xargs -0 -n1 runuser -u mediabot -- perl -I. -c

runuser -u mediabot -- perl -c mediabot.pl

runuser -u mediabot -- perl t/test_commands.pl

Suggested smoke tests

m help internal
m help weather
m listeners
m song

For Partyline, .eval should be refused unless this is explicitly enabled:

PARTYLINE_EVAL_ENABLED=1

You must be logged in to reply.