Skip to content

Configuration Guide

This guide explains how to configure Fast Pluggy for your FastAPI application.

Basic Configuration

When initializing Fast Pluggy, you can provide various configuration options:

from fastapi import FastAPI
from fastpluggy.fastpluggy import FastPluggy

app = FastAPI()

# Initialize with basic configuration
pluggy = FastPluggy(
    app,
    app_root_dir=".",          # Root directory of your application
    path_plugins="./plugins",  # Directory where plugins are stored
    path_modules="./domains",  # Directory where domain modules are stored
    auth_manager=None          # Optional authentication manager
)

Configuration Class

Fast Pluggy uses a configuration class to manage settings:

from fastpluggy.core.config import FastPluggyConfig

# Access configuration
config = pluggy.settings

# Configuration options
print(f"App name: {config.app_name}")
print(f"Admin URL: {config.fp_admin_base_url}")

Configuration Options

Here are the available configuration options in the FastPluggyConfig class:

Option Type Default Description
app_name str "FastPluggy" Name of the application
app_subtitle str "Admin Console" Sidebar brand subtitle under app_name
app_logo_icon str "ti ti-puzzle" Tabler icon class for the brand glyph
debug bool False Enable debug mode
admin_enabled bool True Whether the admin interface is enabled
fp_admin_base_url str "/admin" URL prefix for the admin interface
fp_plugins str "*" Plugin loading pattern
include_in_schema_fp bool True Include FastPluggy routes in OpenAPI schema
show_empty_menu_entries bool True Whether to show empty menu entries
menu_promote_single_parent bool True Promote single-child parent items
install_module_requirement_at_start bool True Whether to install module requirements at startup
show_no_auth_warning bool True Show dismissible banner when no auth is enabled
static_cache_max_age int 86400 Cache-Control max-age for static files (seconds)

session_secret_key / session_https_only (and gzip_enabled / gzip_minimum_size) are also FastPluggyConfig fields, but env-only — set via SESSION_SECRET_KEY / SESSION_HTTPS_ONLY / FASTPLUGGY_GZIP_ENABLED / FASTPLUGGY_GZIP_MINIMUM_SIZE, never via /admin/settings. See features/settings.md for why (the middleware they configure has to be installed once, before the database — a requirement of the degraded-mode self-heal, fast_pluggy#22).

Log level

FastPluggy logs through loguru at INFO by default (core >= 0.4.75). loguru on its own starts at DEBUG, and DEBUG lines from core and plugins can carry plugin settings, secrets included, into docker logs and any log collector. To get the debug output back (a dev machine, a one-off investigation), set the standard loguru variable:

LOGURU_LEVEL=DEBUG

An app that configures loguru itself (removes the default handler and adds its own sinks) is left alone. The debug setting above does not change the log level.

Environment Variables and Database Settings

Fast Pluggy can load settings from environment variables and the database:

# .env file — no FASTPLUGGY_ prefix: FastPluggyConfig sets none, so each field
# maps directly to its UPPERCASE name (see features/settings.md for the full list)
APP_NAME=My App
ADMIN_ENABLED=true
FP_ADMIN_BASE_URL=/manage
SESSION_SECRET_KEY=my-secret-key

The configuration system uses the following sources in order of priority:

  1. Explicitly passed settings
  2. Environment variables
  3. Secrets from files
  4. Database settings

This allows for flexible configuration management across different environments.

Advanced Configuration

Authentication Manager

You can configure Fast Pluggy with a custom authentication manager:

from fastapi import FastAPI
from fastpluggy.fastpluggy import FastPluggy
from your_auth_package import YourAuthBackend

app = FastAPI()

# Create custom authentication backend
auth_backend = YourAuthBackend()

# Pass auth manager to Fast Pluggy
pluggy = FastPluggy(
    app,
    auth_manager=auth_backend
)

You can customize the menu system:

from fastapi import FastAPI
from fastpluggy.fastpluggy import FastPluggy

app = FastAPI()
pluggy = FastPluggy(app)

# Access the menu manager
menu_manager = pluggy.menu_manager

# Get menu items
main_menu = menu_manager.get_menu(menu_type='main')
admin_menu = menu_manager.get_menu(menu_type='admin')

Next Steps

After configuring Fast Pluggy, learn how to manage plugins.