#[non_exhaustive]pub struct DevtoolsConfig {
pub enabled: Enabled,
pub error_text: bool,
pub key: Option<DevtoolsKey>,
pub local: bool,
}Expand description
The developer tools’ settings, read from the environment.
An application may change them in src/app.rs, after they are read:
use laravel_rust_devtools::DevtoolsConfig;
laravel::Application::configure().with_config(|config, _| {
config.section_mut::<DevtoolsConfig>().error_text = true;
});Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: EnabledDEVTOOLS_ENABLED: whether the developer tools run where they may, as Enabled says.
error_text: boolDEVTOOLS_ERROR_TEXT: whether traces record what an error says, which may quote a value.
Off by default: a trace then keeps an error’s kind, where it was raised and when, and records
its text as [masked], in a reported error, a job that will be retried and every field
named error. Turn it on while looking for a bug. Everyone who can read the traces sees
those texts, as the developer tools’ API at /_devtools/api gives them.
key: Option<DevtoolsKey>DEVTOOLS_KEY: the key that opens the developer tools to someone who isn’t on the
application’s own machine, such as a browser behind a proxy. They enter it once at
/_devtools/login, and a cookie signed with APP_KEY lets them in for 12 hours, which the
application checks itself; a new key shuts out every cookie made with the old one. Between
32 and 72 bytes: a build with debug assertions doesn’t start with a shorter or longer one.
Unset, only the machine itself gets in. A build without debug assertions has none of the
developer tools, ignores the key and logs a warning that it is set.
local: boolDEVTOOLS_LOCAL: whether a browser on the application’s own machine gets in without the
key. On by default; turn it off where a proxy or tunnel on the same machine forwards to the
application, such as nginx with proxy_pass http://127.0.0.1:8000: its requests look
local.
Implementations§
Source§impl DevtoolsConfig
impl DevtoolsConfig
Sourcepub fn from_env(env: &Env) -> Self
pub fn from_env(env: &Env) -> Self
Read the section from the environment, starting from its defaults.
| Field | Variable | Default |
|---|---|---|
enabled | DEVTOOLS_ENABLED | the type’s default |
error_text | DEVTOOLS_ERROR_TEXT | false |
key | DEVTOOLS_KEY | none |
local | DEVTOOLS_LOCAL | true |
from_env records invalid values and missing required values in env. Those problems
stop the application from starting.