pub struct AppConfig {Show 33 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 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: u32
Number 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: f64
Maximum number of seconds to wait before giving up when acquiring a database connection from the pool. The default is 10 seconds.
web_root: PathBuf
The directory where the .sql files are located. Defaults to the current directory.
configuration_directory: PathBuf
The directory where the sqlpage configuration file is located. Defaults to ./sqlpage
.
allow_exec: bool
Set 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: usize
Maximum 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: String
The 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: String
Space-separated list of scopes to request during OIDC authentication. Defaults to “openid email profile”
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: PathBuf
The directory to store the Let’s Encrypt certificate in. Defaults to ./sqlpage/https
.
https_acme_directory_url: String
URL to the ACME directory. Defaults to the Let’s Encrypt production directory.
environment: DevOrProd
Whether we should run in development or production mode. Used to determine whether to show error messages to the user.
site_prefix: String
Serve 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: usize
Maximum 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: bool
Whether to compress the http response body when the client supports it.
content_security_policy: ContentSecurityPolicyTemplate
Content-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: bool
Whether 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: u8
Maximum depth of recursion allowed in the run_sql
function.
markdown_allow_dangerous_html: bool
§markdown_allow_dangerous_protocol: bool
Implementations§
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