pub struct ConfigEnv {
pub service_name: String,
pub service_vers: String,
pub pispas_host: String,
pub remote_host: String,
pub remote_port: u16,
pub remote_ussl: bool,
pub local_host: String,
pub local_port: u16,
pub local_ussl: bool,
pub modules: Vec<String>,
pub list_printers: Option<Vec<String>>,
}Expand description
Runtime configuration loaded from the install’s .env file.
ConfigEnv is the single struct that every binary reads at startup.
Fields are plain POD (strings, booleans, ports) so the type is trivially
serializable to JSON for the Tauri configurator UI.
§Lifecycle
- The installer writes a default
.envviainit_envon first run. - Each binary calls
ConfigEnv::loadat startup, which reads the.envthroughdotenv::from_pathand materialises the struct. - The configurator calls
ConfigEnv::saveafter the user edits a field, then pushes an IPC restart message topispas-modules.
§Invariants
local_ussl = truerequires the embedded TLS cert and a client that connects viawss://local.unpispas.es:<local_port>. Binding to127.0.0.1is fine because DNS resolveslocal.unpispas.esthere.modulesis an ordered list used bypispas_modules::load_servicesto instantiate the services. Names not in the match arm are logged and ignored.
§Extending
Adding a field requires touching four places — see CLAUDE.md § 5.
Forgetting one of them silently resets the new field to its default
every time the user saves from the configurator.
Fields§
§service_name: StringStable identity of this install. Used as the Windows Service name and echoed back in every WebSocket message envelope.
service_vers: StringBuild version tag, echoed in message envelopes for log correlation.
pispas_host: StringBackend REST API hostname (e.g. api.unpispas.es).
remote_host: StringBackend WebSocket hostname that pispas-modules keeps an outbound
connection to (e.g. wss.unpispas.es).
remote_port: u16Backend WebSocket port. Usually 443.
remote_ussl: booltrue → connect with wss://, false → ws://.
local_host: StringBind address for the local WebSocket server. Almost always
127.0.0.1. See docs/CONFIGURATION.md before changing.
local_port: u16Bind port for the local WebSocket server. Default 5005.
local_ussl: booltrue → accept TLS on the local socket (recommended for browser
clients that require wss://). The listener is dual-mode and still
accepts plain ws:// when this is on.
modules: Vec<String>Ordered list of service modules to load at boot
(base, print, paytef, …).
list_printers: Option<Vec<String>>Cached printer list shown in the configurator UI. Refreshed by the service on demand.
Implementations§
Source§impl ConfigEnv
impl ConfigEnv
pub fn load() -> Self
pub fn change_service_name(&mut self, new_name: &str)
pub fn change_service_vers(&mut self, new_vers: &str)
pub fn change_pispas_host(&mut self, new_host: &str)
pub fn change_remote_host(&mut self, new_host: &str)
pub fn change_remote_port(&mut self, new_port: u16)
pub fn change_remote_ussl(&mut self, ussl: bool)
pub fn change_local_host(&mut self, new_host: &str)
pub fn change_local_port(&mut self, new_port: u16)
pub fn change_local_ussl(&mut self, ussl: bool)
pub fn change_modules(&mut self, new_modules: Vec<String>)
pub fn save(&self)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ConfigEnv
impl<'de> Deserialize<'de> for ConfigEnv
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>,
impl StructuralPartialEq for ConfigEnv
Auto Trait Implementations§
impl Freeze for ConfigEnv
impl RefUnwindSafe for ConfigEnv
impl Send for ConfigEnv
impl Sync for ConfigEnv
impl Unpin for ConfigEnv
impl UnwindSafe for ConfigEnv
Blanket Implementations§
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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