Configuration File

BYCEPS is meant to be configured with a configuration file.

An example file is available at config/config.toml.example.

Top-Level Section

locale = "en"
propagate_exceptions = false
secret_key = "INDIVIDUAL-KEY-GOES-HERE"
timezone = "Europe/Berlin"
locale
Type:
string

The default locale.

required

propagate_exceptions
Type:
boolean
Default:
false

Reraise exceptions instead of letting BYCEPS handle them.

This is useful if an external service like Sentry should handle exceptions.

If not set, this is implicitly true if debug mode and/or testing mode are enabled.

Handled by Flask.

optional

secret_key
Type:
string

A secret key that will be for security features such as signing session cookies.

Should be a long, random string.

BYCEPS provides a command-line tool to securely generate a secret key.

required

timezone
Type:
string

The default timezone.

required

Applications Section

Maps applications to hostnames.

At least one application has to be specified.

An example with admin application, API application, and two sites:

[apps]
admin = { server_name = "admin.example" }
api = { server_name = "api.example" }
sites = [
  { server_name = "site1.example", site_id = "site1" },
  { server_name = "site2.example", site_id = "site2" },
]
apps.admin
Type:
string

Hostname to mount the admin application on.

optional

apps.api
Type:
string

Hostname to mount the API application on.

optional

apps.sites
Type:
string

Hostnames to mount site applications on.

optional

Database Section

Properties to connect to the relational database (i.e. PostgreSQL) with.

An example that connects to PostgreSQL on the local host and the default port, authenticating as user byceps with password hunter2, and selecting the named database byceps:

[database]
host = "localhost"
port = 5432
username = "byceps"
password = "hunter2"
database = "byceps"
database.host
Type:
string
Default:
"localhost"

Hostname to connect to.

optional

database.port
Type:
int
Default:
5432

Port to connect to.

optional

database.username
Type:
string

Username to authenticate with.

required

database.password
Type:
string

Password to authenticate with.

required

database.database
Type:
string

Database to use.

required

Development Section

Development helpers

An example that enables the style guide but not the debug toolbar:

[development]
style_guide_enabled = true
toolbar_enabled = false
development.style_guide_enabled
Type:
boolean
Default:
false

Enables BYCEPS’ style guide, available at /style_guide/ both in admin mode and site mode.

optional

development.toolbar_enabled
Type:
boolean
Default:
false

Enables the debug toolbar (provided by Flask-DebugToolbar).

optional

Discord Section

Integration with Discord.

[discord]
enabled = true
client_id = "discord-client-id"
client_secret = "discord-client-secret"
discord.enabled
Type:
boolean
Default:
false

Enables the integration Discord.

required if section is defined

discord.client_id
Type:
string

Discord client ID.

required if section is defined

discord.client_secret
Type:
string

Discord client secret.

required if section is defined

Invoice Ninja Section

Integration with Invoice Ninja.

[invoiceninja]
enabled = true
api_key = "random-characters"
base_url = "https://invoiceninja.example"
invoiceninja.enabled
Type:
boolean
Default:
false

Enables the integration with Invoice Ninja.

required if section is defined

invoiceninja.api_key
Type:
string

Invoice Ninja API key.

required if section is defined

invoiceninja.base_url
Type:
string

Base URL (without trailing slash) of the Invoice Ninja instance to integrate with.

required if section is defined

Metrics Section

Enable the Prometheus-compatible metrics endpoint at /metrics/.

Only available on the admin application.

An example that enables the metrics endpoint:

[metrics]
enabled = true
metrics.enabled
Type:

boolean

Default:

false

Enables the metrics endpoint.

required if section is defined

Payment Gateways Section

Payment gateway integrations

PayPal Section

Integration with payment gateway provider PayPal.

[payment_gateways.paypal]
enabled = true
client_id = "paypal-client-id"
client_secret = "paypal-client-secret"
environment = "sandbox"
payment_gateways.paypal.client_id
Type:
string

The client ID for payments via PayPal.

required if section is defined

payment_gateways.paypal.client_secret
Type:
string

The client secret for payments via PayPal.

required if section is defined

payment_gateways.paypal.environment
Type:
string

The environment for payments via PayPal.

sandbox for testing, live for production use.

required if section is defined

Stripe Section

Integration with payment gateway provider Stripe.

[payment_gateways.stripe]
enabled = true
secret_key = "stripe-secret-key"
publishable_key = "stripe-publishable-key"
webhook_secret = "stripe-webhook-secret"
payment_gateways.stripe.publishable_key
Type:
string

The publishable key for payments via Stripe.

required if section is defined

payment_gateways.stripe.secret_key
Type:
string

The secret key for payments via Stripe.

required if section is defined

payment_gateways.stripe.webhook_secret
Type:
string

The webhook secret for payments via Stripe.

required if section is defined

Redis Section

URL to connect to the Redis database with.

An example for a Redis instance running on the local host on its default port, using the first database (#0):

[redis]
url = "redis://127.0.0.1:6379/0"
redis.url
Type:
string

The URL used to connect to Redis.

The format can be one of these:

  • redis://[[username]:[password]]@localhost:6379/0 (TCP socket)

  • rediss://[[username]:[password]]@localhost:6379/0 (SSL-wrapped TCP socket)

  • unix://[[username]:[password]]@/path/to/socket.sock?db=0 (Unix domain socket)

The documentation for Redis.from_url provides details on supported URL schemes and examples.

required

SMTP Section

E-mail sending via the Simple Mail Transfer Protocol (SMTP).

An example to send e-mail to a mail server on the local host on its standard port:

[smtp]
host = "localhost"
port = 25
starttls = true
use_ssl = true
username = "smtp-user"
password = "smtp-password"
suppress_send = false
smtp.host
Type:
string
Default:
"localhost"

The host of the SMTP server.

optional

smtp.password
Type:
string
Default:
""

The password to authenticate with against the SMTP server.

optional

smtp.port
Type:
integer
Default:
25

The port of the SMTP server.

optional

smtp.starttls
Type:
boolean
Default:
false

Put the SMTP connection in TLS (Transport Layer Security) mode.

optional

smtp.suppress_send
Type:
boolean
Default:
false

Suppress sending of e-mails.

optional

smtp.use_ssl
Type:
boolean
Default:
false

Use SSL for the connection to the SMTP server.

optional

smtp.username
Type:
string
Default:
""

The username to authenticate with against the SMTP server.

optional