Skip to content

Configuration

Jared Dantis edited this page Sep 19, 2023 · 7 revisions

Configuration

You can configure Blanco using either a YAML file or environment variables. When you have both, configuration from environment variables takes precedence over configuration from the YAML file.

Environment variables

The following table lists the environment variables that Blanco accepts:

Variable name Description Type Required?
BLANCO_DB_FILE Path to SQLite database file String ✅
BLANCO_TOKEN Discord bot token String ✅
BLANCO_SPOTIFY_ID Spotify client ID String ✅
BLANCO_SPOTIFY_SECRET Spotify client secret String ✅
BLANCO_ENABLE_SERVER Whether to enable the webserver true or false
BLANCO_LASTFM_KEY Last.fm API key String
BLANCO_LASTFM_SECRET Last.fm API shared secret String
BLANCO_DEBUG Whether to enable debug mode true or false
BLANCO_DEBUG_GUILDS Guild IDs to register slash commands in when debug mode is enabled Comma-separated list of integers

If BLANCO_ENABLE_SERVER is set to true, Blanco expects the following additional environment variables:

Variable name Description Type Required?
BLANCO_SERVER_PORT Port that the webserver listens on Integer
BLANCO_BASE_URL Webserver base URL String ✅
BLANCO_OAUTH_ID Discord OAuth client ID String ✅
BLANCO_OAUTH_SECRET Discord OAuth client secret String ✅

BLANCO_SERVER_PORT defaults to 8080. Having this configurable is especially useful when running Blanco in host networking mode, e.g., when running Lavalink and Blanco in the same Docker host with IPv6 support enabled.

Additionally, Blanco expects the following environment variables to be set for each Lavalink node, where n in the variable name is an integer incrementing from 1:

Variable name Description Required? Format Example
BLANCO_NODE_n Node connection details ✅ label:password@host:port main:youshallnotpass@localhost:2333
BLANCO_NODE_n_REGIONS Node regions ✅ Comma-separated list of strings us-central,us-east
BLANCO_NODE_n_SECURE Whether the node supports SSL true or false false
BLANCO_NODE_n_DEEZER Whether the node supports playback from Deezer via LavaSrc true or false false

Make sure n is a unique integer for each node, and that you don't skip values of n.

YAML file

Create an empty directory and create a file named config.yml in it, with the following contents:

bot:
  database: blanco.db
  discord_token: <your Discord bot token>
  debug: # Optional
    enabled: true
    guild_ids:
      - 123456789012345678
server: # Optional
  enabled: false
  port: 8080
  base_url: http://localhost:8080
  oauth_id: <your Discord OAuth client ID>
  oauth_secret: <your Discord OAuth client secret>
spotify:
  client_id: <your client id>
  client_secret: <your client secret>
lastfm: # Optional
  api_key: <your Last.fm API key>
  shared_secret: <your Last.fm API shared secret>
lavalink:
  - id: main
    server: localhost
    port: 2333
    password: youshallnotpass
    regions: 
      - us-central
      - us-east

    # Set to true if node supports SSL (https://, wss://)
    ssl: false
    
    # Set to true if node supports playback from Deezer using LavaSrc
    deezer: false
# You may add more than one node here
# - id: backup
#   ...

Sentry integration

Starting with Release 0.5.0, Blanco can forward warnings and errors to a Sentry project. If you wish to use this integration, define the following in your environment variables:

Env variable Description Type
BLANCO_SENTRY_DSN Sentry data source name (DSN) URL
BLANCO_SENTRY_ENV Sentry project environment String

Or if you're using a YAML file, add the following section:

sentry:
  dsn: https://...ingest.sentry.io/...
  environment: <environment>      # example: production, staging, etc.

Database

We also need to create an empty database file which will be used by the bot to store settings. Open a terminal in a folder of your choosing and run the following command:

# Windows cmd
type nul > blanco.db

# Linux, macOS, etc.
touch blanco.db

Then point the bot to the database file path by setting either the BLANCO_DB_FILE environment variable or the bot.database key in the YAML file.

Clone this wiki locally