Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Credentials

Secrets are never in the config file. On Linux they are systemd credentials, encrypted at rest with the host key (systemd-creds encrypt) and decrypted only into the service’s private $CREDENTIALS_DIRECTORY while it runs. Without systemd (for development) each one can come from an environment variable instead. A credential file wins over the environment variable; a trailing newline is stripped; an empty value counts as missing.

CredentialEncrypted fileEnvironment variableRequiredWhat it is
discord_token/etc/polarbot/discord_token.credPOLARBOT_DISCORD_TOKENyes: the bot does not start without itThe bot token from the Discord Developer Portal (Bot → Reset Token). install.sh asks for it with hidden input.
discord_client_secret/etc/polarbot/discord_client_secret.credPOLARBOT_DISCORD_CLIENT_SECRETno: without it command visibility sync and the web server are offThe application’s OAuth2 client secret (Developer Portal → OAuth2), used to exchange /perms authorize codes and refresh tokens.
oauth_key/etc/polarbot/oauth_key.credPOLARBOT_OAUTH_KEYno: same as discord_client_secret (both are needed)32 random bytes as 64 hex characters. Subkeys derived from it (HKDF-SHA256) sign the OAuth state (HMAC-SHA256) and encrypt stored refresh tokens (AES-256-GCM). install.sh generates it. A new key invalidates every stored authorization.

The unit loads them with:

LoadCredentialEncrypted=discord_token:/etc/polarbot/discord_token.cred
LoadCredentialEncrypted=discord_client_secret:/etc/polarbot/discord_client_secret.cred
LoadCredentialEncrypted=oauth_key:/etc/polarbot/oauth_key.cred