kit_rs/inertia/
config.rs

1/// Configuration for Inertia.js integration
2pub struct InertiaConfig {
3    /// Vite dev server URL (e.g., "http://localhost:5173")
4    pub vite_dev_server: String,
5    /// Entry point for the frontend (e.g., "src/main.tsx")
6    pub entry_point: String,
7    /// Asset version for cache busting
8    pub version: String,
9    /// Whether we're in development mode (use Vite dev server)
10    pub development: bool,
11}
12
13impl Default for InertiaConfig {
14    fn default() -> Self {
15        Self {
16            vite_dev_server: "http://localhost:5173".to_string(),
17            entry_point: "src/main.tsx".to_string(),
18            version: "1.0".to_string(),
19            development: true,
20        }
21    }
22}
23
24impl InertiaConfig {
25    pub fn new() -> Self {
26        Self::default()
27    }
28
29    pub fn vite_dev_server(mut self, url: impl Into<String>) -> Self {
30        self.vite_dev_server = url.into();
31        self
32    }
33
34    pub fn entry_point(mut self, entry: impl Into<String>) -> Self {
35        self.entry_point = entry.into();
36        self
37    }
38
39    pub fn version(mut self, version: impl Into<String>) -> Self {
40        self.version = version.into();
41        self
42    }
43
44    pub fn production(mut self) -> Self {
45        self.development = false;
46        self
47    }
48}