pub struct CookieConfig {
pub name: String,
pub domain: Option<String>,
pub secure: bool,
pub same_site: SameSite,
pub max_age_secs: u64,
pub path: String,
}Fields§
§name: String§domain: Option<String>Domain attribute. None → host-only cookie (correct for localhost
and for single-host prod). .example.com → shared across subdomains.
secure: bool§same_site: SameSite§max_age_secs: u64Cookie lifetime in seconds; matches the server-side session TTL by default so the browser drops the cookie at the same moment the session would have expired anyway.
path: StringImplementations§
Source§impl CookieConfig
impl CookieConfig
Sourcepub fn from_env(default_name: &str) -> Self
pub fn from_env(default_name: &str) -> Self
Build from environment, with default_name derived from the app’s
manifest name (falls back to pylon if the manifest is unnamed).
Honored env vars:
- PYLON_COOKIE_NAME — overrides the derived default.
- PYLON_COOKIE_DOMAIN — e.g.
.pylonsync.comfor cross-subdomain. - PYLON_COOKIE_SECURE —
1/true/0/false. Auto-disabled in dev unless explicitly forced. - PYLON_COOKIE_SAME_SITE —
strict|lax|none. Defaultlax.
Sourcepub fn default_name_for(app_name: &str) -> String
pub fn default_name_for(app_name: &str) -> String
Default cookie name for an app: ${app_name}_session. Sanitises the
app name so values that aren’t valid in a Set-Cookie name (spaces,
=, ;, etc.) don’t end up in the header.
Sourcepub fn set_value(&self, token: &str) -> String
pub fn set_value(&self, token: &str) -> String
Build the Set-Cookie header value carrying a session token.
Sourcepub fn clear_value(&self) -> String
pub fn clear_value(&self) -> String
Build the Set-Cookie header value that clears the cookie. The browser drops it immediately because Max-Age is 0.
Trait Implementations§
Source§impl Clone for CookieConfig
impl Clone for CookieConfig
Source§fn clone(&self) -> CookieConfig
fn clone(&self) -> CookieConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more