Skip to main content

Secrets

Some settings are passwords and keys. Keep them out of config.yaml and give them to Lyna through environment variables instead. Lyna never writes an environment value back into the file.

Which settings are secrets​

SettingEnvironment variable
baseSettings.tokenBOT_TOKEN
database.passwordDB_PASSWORD
auth.jwtSecretAUTH_JWTSECRET
auth.tokenKeyAUTH_TOKENKEY
discord.oauth.clientSecretDISCORD_OAUTH_CLIENTSECRET
nexus.passwordNEXUS_PASSWORD
mailing.passwordMAIL_PASSWORD
kofi.verificationTokenKOFI_VERIFICATIONTOKEN
license.baseSeedLICENSE_BASESEED
github.tokenGITHUB_TOKEN

Leave the value in the file empty (""). The environment variable wins over it.

Making the secrets​

auth.jwtSecret is yours to make up. Use a long random value:

openssl rand -base64 48

The rest come from the services they belong to: Discord, your Nexus, your mail provider and Ko-fi.

With Docker Compose​

Put the values into an .env file beside your compose.yaml and hand them to the backend:

BOT_TOKEN=...
DB_PASSWORD=...
AUTH_JWTSECRET=...
DISCORD_OAUTH_CLIENTSECRET=...
NEXUS_PASSWORD=...
services:
backend:
env_file: .env

Keep .env out of version control and readable only by you. The full file is on Docker Compose.

The token key​

When somebody signs in with Discord, Lyna stores their Discord tokens encrypted. The key for that is found in this order:

  1. auth.tokenKey or AUTH_TOKENKEY, as base64.
  2. The file config/token.key.
  3. Neither exists: Lyna makes a new key, writes it to config/token.key and logs where.

Back up config/token.key with your database. A database dump alone can't decrypt the tokens, which is the point.

If the key is lost, the stored Discord tokens can't be read. Nothing else is lost: each person's tokens are stored again the next time they sign in with Discord. If the key file is there but can't be read, Lyna refuses to start rather than make a new key over it.

To keep the key out of files entirely, make one and pass it as AUTH_TOKENKEY:

openssl rand -base64 32

Changing a secret​

SecretWhat happens when it changes
auth.jwtSecretEverybody is signed out.
auth.tokenKeyStored Discord tokens can't be read until each person signs in with Discord again.
license.baseSeedNew license keys come from the new seed. Keep it once licenses exist.
Anything elseTakes effect on the next start.