Configuration¶
Dazzler makes extensive use of a config system accessible thru the application
config
property. The values of the config can set by,
in order of priority:
Code
CLI Argument
Environment variable
Config file
File¶
Generate an empty configuration file at the root of the project:
$ dazzler dump-configs dazzler.toml
Default config¶
# Dazzler configuration
app_title = "Dazzler" # Name of the title of the index.
host = "127.0.0.1" # Host address
port = 8150 # Port of the server
# Try to open the server starting from port until success.
port_range = false
version = "0.1.0" # App version
debug = false
# Route prefix for all dazzler related endpoints.
route_prefix = ""
# Path relative to project folder where files will be served.
static_folder = "static"
static_prefix = "/static" # Prefix for the static route
secret_key = "Please change me" # Secret key to use for signing sessions.
# Directory where pages will be automatically added to the app, path is
# relative to the app file. Unsupported with electron
pages_directory = "pages"
[session]
enable = true
# Type of session backend to use. Choices: File, Redis, PostgreSQL
backend = "File"
# salt = # Uncomment to use
cookie_name = "sessionid" # Name of the session cookie.
# Maximum duration of a session in seconds. (Default=30 days)
duration = 2592000
# Refresh the session when accessed after this number of seconds.
# (Default=7 days)
refresh_after = 604800
[requirements]
# Prefer serving external requirements when available
prefer_external = false
# List of urls to include as script requirement.
external_scripts = []
# List of files to include as script requirement.
internal_scripts = []
# List of urls to include as style requirement.
external_styles = []
# List of files to include as script requirement.
internal_styles = []
# Where requirements files will be copied to serve as static. If left
# empty, a user directory will be used.
static_directory = ""
static_url = "/dazzler/requirements/static" # Url to use for the requirements static.
# Remove the requirements directory before copying the new requirements.
clean_directory = true
[renderer]
# Number of times it will try to reconnect when the websocket connection
# is lost.
retries = 20
# Enable to send a ping every interval to keep the websocket connected
# if it didn't send data after a delay. Some hosts providers will
# automatically closes idling connection after a while.
ping = false
ping_interval = 25.0 # Interval at which to send ping data.
[authentication]
enable = false
# Path to an instance or subclass of `dazzler.system.auth.Authenticator`
authenticator = ""
# Path to an instance or subclass of `dazzler.system.auth.AuthBackend`
backend = ""
[authentication.login]
# Url to use by default if no next_url is available.
default_redirect = "/"
page_title = "Login" # Title of the login page
# Url for the login page and related routes.
page_url = "/auth"
form_header = "Sign In" # Title of the login form.
[authentication.register]
enable = true
# Require the user to provide an email on the register page.
require_email = true
page_name = "register" # Name of the register page
page_url = "/auth/register"
custom_fields = []
# Redirect to after successfully creating a new user.
next_url = "/"
# Prevent registering with those usernames, case insensitive.
reserved_usernames = ["admin", "administrator", "staff", "user", "superuser", "moderator"]
username_pattern = "[\\w\\d\\-_]+" # Pattern to match the username input.
[authentication.admin]
# Enable the user admin page to manage role & users.
enable = false
page_url = "/auth/admin" # Url for the admin page.
# Must be set if enabled, path to an subclass of UserAdminPage
page_ref = ""
page_name = "user_admin"
page_title = "User Administration"
# Authorizations required to access the user admin page
authorizations = ["admin"]
[development]
# Enable hot reload when files used by the application are changed.
reload = false
# Interval at which the reload checks for file changes.
reload_interval = 0.5
# Time to wait from first detected change to actual reload.
reload_threshold = 3.0
# Delay until the reloader start watching for changes.Some libraries
# changes their files when first run.
reload_delay = 5.0
[electron]
# List of page names to create a window from.
windows = []
# Path to a file to use as electron-builder configuration.
# build_config_file = # Uncomment to use
# Save the window size in the app local directory as json.
save_window_size = true
# Path to the icon to use for the application. For windows .ico works
# best when created with multiple resolutions. Otherwise a PNG 512x512.
icon = ""
# Package the application using asar, not recommended toset to false by
# electron-builder but if you have trouble with packaging extra files
# you can disable this.
asar = true
[electron.window_size]
# Default window size to use when first creating the window.
width = 800 # Default width of the window.
height = 600 # Default height of the window.
fullscreen = false
[electron.loading_window]
# Add a loading window while waiting for the server to be available.
enabled = false
# Path to an html file to use as loading window.
html_file = ""
title = "Loading"
# Html to include on top of the default loading spinner
header = ""
footer = "<div>loading</div>"
[electron.loading_window.options]
width = 300 # Width of the loading window.
height = 400 # Height of the loading window.
# Custom title to use for the loading window.
# title = # Uncomment to use
fullscreen = false
# Center the loading window in the middleof the screen.
center = true
resizable = false
minimizable = false
maximizable = false
# Turn off to activate icon on the taskbar with the loading window.
skip_taskbar = true
# Create a frameless window if disabled, it has no toolbars.
frame = false
opacity = 1.0
transparent = false
# Options: default, hidden, hiddenInset, customButtonsOnHover
title_bar_style = "default"
click_through = true
[electron.metadata]
# Target package.json attributes and should be defined.
# App name to use when packaging. No spaces.
app_name = ""
# Description of the application to use when packaging.
description = ""
# Url for the project. (Required for NuGet or Linux Package URL)
homepage = ""
license = "" # Name of the license. (Linux only)
[electron.metadata.author]
name = ""
email = ""
[electron.builder]
# The appId to use for the build, it is recommended to change.
# app_id = # Uncomment to use
# Executable name that can contains spaces. Defaults to
# electron.metadata.name
# product_name = # Uncomment to use
copyright = "Copyright © year ${author}" # Copyright line to use in the installer.
electron_version = "^16.0.2" # Electron version to use for the build.
# Electron builder version to use for the build.
electron_builder_version = "^22.11.7"
[electron.target]
# options_file = # Uncomment to use
# List of architecture to target. Possible values: “x64” | “ia32” |
# “armv7l” | “arm64”> | “x64” | “ia32” | “armv7l” | “arm64”
# arch = # Uncomment to use
# For multi platform targets like 7z and zip, specify the platform (os)
# to configure. One of: "win", "linux", "mac"
# platform = # Uncomment to use
[electron.target.linux]
# maintainer = # Uncomment to use
# vendor = # Uncomment to use
# synopsis = # Uncomment to use
# category = # Uncomment to use
# executable_name = # Uncomment to use
# mime_types = # Uncomment to use
[electron.target.win]
# legal_trademarks = # Uncomment to use
# signing_hash_algorithms = # Uncomment to use
# certificate_file = # Uncomment to use
# certificate_password = # Uncomment to use
# certificate_subject_name = # Uncomment to use
# certificate_sha1 = # Uncomment to use
# additional_certificate_file = # Uncomment to use
# publisher_name = # Uncomment to use
# verify_update_code_signature = # Uncomment to use
# requested_execution_level = # Uncomment to use
[electron.target.mac]
# entitlements = # Uncomment to use
# entitlements_inherit = # Uncomment to use
# provisioning_profile = # Uncomment to use
# type = # Uncomment to use
# binaries = # Uncomment to use
# hardened_runtime = # Uncomment to use
# gatekeeper_assess = # Uncomment to use
[electron.publish]
# One of: "generic", "bintray", "github", "s3", "spaces", "snap"
provider = ""
[electron.publish.generic]
url = ""
channel = "latest"
# use_multiple_range_request = # Uncomment to use
[electron.publish.bintray]
package = ""
repo = "generic"
# owner = # Uncomment to use
# component = # Uncomment to use
# distribution = # Uncomment to use
# user = # Uncomment to use
# token = # Uncomment to use
[electron.publish.github]
# repo = # Uncomment to use
# owner = # Uncomment to use
v_prefixed_tag_name = true
host = "github.com"
protocol = "https"
# token = # Uncomment to use
# private = # Uncomment to use
release_type = "draft"
[electron.publish.s3]
# Help
bucket = ""
# region = # Uncomment to use
# acl = # Uncomment to use
# storage_class = # Uncomment to use
# encryption = # Uncomment to use
# endpoint = # Uncomment to use
# channel = # Uncomment to use
# path = # Uncomment to use
[electron.publish.spaces]
# Digital ocean, define DO_KEY_ID & DO_SECRET_KEY
# name = # Uncomment to use
# region = # Uncomment to use
# channel = # Uncomment to use
# path = # Uncomment to use
# acl = # Uncomment to use
[electron.publish.snap]
channels = ["edge"]
See also
Config system provided by Precept