pub struct AppConfig {Show 36 fields
pub database_url: String,
pub database_password: Option<String>,
pub max_database_pool_connections: Option<u32>,
pub database_connection_idle_timeout_seconds: Option<f64>,
pub database_connection_max_lifetime_seconds: Option<f64>,
pub sqlite_extensions: Vec<String>,
pub listen_on: Option<SocketAddr>,
pub port: Option<u16>,
pub unix_socket: Option<PathBuf>,
pub database_connection_retries: u32,
pub database_connection_acquire_timeout_seconds: f64,
pub web_root: PathBuf,
pub configuration_directory: PathBuf,
pub allow_exec: bool,
pub max_uploaded_file_size: usize,
pub oidc_issuer_url: Option<IssuerUrl>,
pub oidc_client_id: String,
pub oidc_client_secret: Option<String>,
pub oidc_scopes: String,
pub oidc_protected_paths: Vec<String>,
pub oidc_public_paths: Vec<String>,
pub oidc_additional_trusted_audiences: Option<Vec<String>>,
pub https_domain: Option<String>,
pub host: Option<String>,
pub https_certificate_email: Option<String>,
pub https_certificate_cache_dir: PathBuf,
pub https_acme_directory_url: String,
pub environment: DevOrProd,
pub site_prefix: String,
pub max_pending_rows: usize,
pub compress_responses: bool,
pub content_security_policy: ContentSecurityPolicyTemplate,
pub system_root_ca_certificates: bool,
pub max_recursion_depth: u8,
pub markdown_allow_dangerous_html: bool,
pub markdown_allow_dangerous_protocol: bool,
}Fields§
§database_url: String§database_password: Option<String>A separate field for the database password. If set, this will override any password specified in the database_url.
max_database_pool_connections: Option<u32>§database_connection_idle_timeout_seconds: Option<f64>§database_connection_max_lifetime_seconds: Option<f64>§sqlite_extensions: Vec<String>§listen_on: Option<SocketAddr>§port: Option<u16>§unix_socket: Option<PathBuf>§database_connection_retries: u32Number of times to retry connecting to the database after a failure when the server starts up. Retries will happen every 5 seconds. The default is 6 retries, which means the server will wait up to 30 seconds for the database to become available.
database_connection_acquire_timeout_seconds: f64Maximum number of seconds to wait before giving up when acquiring a database connection from the pool. The default is 10 seconds.
web_root: PathBufThe directory where the .sql files are located. Defaults to the current directory.
configuration_directory: PathBufThe directory where the sqlpage configuration file is located. Defaults to ./sqlpage.
allow_exec: boolSet to true to allow the sqlpage.exec function to be used in SQL queries.
This should be enabled only if you trust the users writing SQL queries, since it gives
them the ability to execute arbitrary shell commands on the server.
max_uploaded_file_size: usizeMaximum size of uploaded files in bytes. The default is 10MiB (10 * 1024 * 1024 bytes)
oidc_issuer_url: Option<IssuerUrl>The base URL of the OpenID Connect provider.
Required when enabling Single Sign-On through an OIDC provider.
oidc_client_id: StringThe client ID assigned to SQLPage when registering with the OIDC provider.
Defaults to sqlpage.
oidc_client_secret: Option<String>The client secret for authenticating SQLPage to the OIDC provider.
Required when enabling Single Sign-On through an OIDC provider.
oidc_scopes: StringSpace-separated list of scopes to request during OIDC authentication. Defaults to “openid email profile”
oidc_protected_paths: Vec<String>Defines a list of path prefixes that should be protected by OIDC authentication.
By default, all paths are protected.
If you specify a list of prefixes, only requests whose path starts with one of the prefixes will require authentication.
For example, if you set this to ["/private"], then requests to /private/some_page.sql will require authentication,
but requests to /index.sql will not.
NOTE: OIDC_PUBLIC_PATHS takes precedence over OIDC_PROTECTED_PATHS.
For example, if you have ["/private"] on the protected_paths like before, but also ["/private/public"] on the public_paths, then /private requires authentication, but /private/public requires not authentication.
You cannot make a path inside a public path private again. So expanding the previous example, if you now add /private/public/private_again, then this path will still be accessible.
oidc_public_paths: Vec<String>Defines path prefixes to exclude from OIDC authentication.
By default, no paths are excluded.
Paths matching these prefixes will not require authentication.
For example, if set to ["/public"], requests to /public/some_page.sql will not require authentication,
but requests to /index.sql will still require it.
To make /protected/public.sql public while protecting its containing directory,
set oidc_public_paths to ["/protected/public.sql"] and oidc_protected_paths to ["/protected"].
Be aware that any path starting with /protected/public.sql (e.g., /protected/public.sql.backup) will also become public.
oidc_additional_trusted_audiences: Option<Vec<String>>Additional trusted audiences for OIDC JWT tokens, beyond the client ID. By default (when None), all additional audiences are trusted for compatibility with providers that include multiple audience values (like ZITADEL, Azure AD, etc.). Set to an empty list to only allow the client ID as audience. Set to a specific list to only allow those specific additional audiences.
https_domain: Option<String>A domain name to use for the HTTPS server. If this is set, the server will perform all the necessary steps to set up an HTTPS server automatically. All you need to do is point your domain name to the server’s IP address.
It will listen on port 443 for HTTPS connections, and will automatically request a certificate from Let’s Encrypt using the ACME protocol (requesting a TLS-ALPN-01 challenge).
host: Option<String>The hostname where your application is publicly accessible (e.g., “myapp.example.com”).
This is used for OIDC redirect URLs. If not set, https_domain will be used instead.
https_certificate_email: Option<String>The email address to use when requesting a certificate from Let’s Encrypt.
Defaults to contact@<https_domain>.
https_certificate_cache_dir: PathBufThe directory to store the Let’s Encrypt certificate in. Defaults to ./sqlpage/https.
https_acme_directory_url: StringURL to the ACME directory. Defaults to the Let’s Encrypt production directory.
environment: DevOrProdWhether we should run in development or production mode. Used to determine whether to show error messages to the user.
site_prefix: StringServe the website from a sub path. For example, if you set this to /sqlpage/, the website will be
served from https://yourdomain.com/sqlpage/. Defaults to /.
This is useful if you want to serve the website on the same domain as other content, and
you are using a reverse proxy to route requests to the correct server.
max_pending_rows: usizeMaximum number of messages that can be stored in memory before sending them to the client. This prevents a single request from using up all available memory.
compress_responses: boolWhether to compress the http response body when the client supports it.
content_security_policy: ContentSecurityPolicyTemplateContent-Security-Policy header to send to the client. If not set, a default policy allowing
- scripts from the same origin,
- script elements with the
nonce="{{@csp_nonce}}"attribute,
system_root_ca_certificates: boolWhether sqlpage.fetch should load trusted certificates from the operating system’s certificate store
By default, it loads Mozilla’s root certificates that are embedded in the SQLPage binary, or the ones pointed to by the
SSL_CERT_FILE and SSL_CERT_DIR environment variables.
max_recursion_depth: u8Maximum depth of recursion allowed in the run_sql function.
markdown_allow_dangerous_html: bool§markdown_allow_dangerous_protocol: boolImplementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AppConfig
impl<'de> Deserialize<'de> for AppConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl MarkdownConfig for AppConfig
impl MarkdownConfig for AppConfig
fn allow_dangerous_html(&self) -> bool
fn allow_dangerous_protocol(&self) -> bool
Source§impl TryFrom<&AppConfig> for OidcConfig
impl TryFrom<&AppConfig> for OidcConfig
impl StructuralPartialEq for AppConfig
Auto Trait Implementations§
impl Freeze for AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfig
impl Sync for AppConfig
impl Unpin for AppConfig
impl UnwindSafe for AppConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more