ConfigEnv

Struct ConfigEnv 

Source
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

  1. The installer writes a default .env via init_env on first run.
  2. Each binary calls ConfigEnv::load at startup, which reads the .env through dotenv::from_path and materialises the struct.
  3. The configurator calls ConfigEnv::save after the user edits a field, then pushes an IPC restart message to pispas-modules.

§Invariants

  • local_ussl = true requires the embedded TLS cert and a client that connects via wss://local.unpispas.es:<local_port>. Binding to 127.0.0.1 is fine because DNS resolves local.unpispas.es there.
  • modules is an ordered list used by pispas_modules::load_services to 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: String

Stable identity of this install. Used as the Windows Service name and echoed back in every WebSocket message envelope.

§service_vers: String

Build version tag, echoed in message envelopes for log correlation.

§pispas_host: String

Backend REST API hostname (e.g. api.unpispas.es).

§remote_host: String

Backend WebSocket hostname that pispas-modules keeps an outbound connection to (e.g. wss.unpispas.es).

§remote_port: u16

Backend WebSocket port. Usually 443.

§remote_ussl: bool

true → connect with wss://, falsews://.

§local_host: String

Bind address for the local WebSocket server. Almost always 127.0.0.1. See docs/CONFIGURATION.md before changing.

§local_port: u16

Bind port for the local WebSocket server. Default 5005.

§local_ussl: bool

true → 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

Source

pub fn load() -> Self

Source

pub fn change_service_name(&mut self, new_name: &str)

Source

pub fn change_service_vers(&mut self, new_vers: &str)

Source

pub fn change_pispas_host(&mut self, new_host: &str)

Source

pub fn change_remote_host(&mut self, new_host: &str)

Source

pub fn change_remote_port(&mut self, new_port: u16)

Source

pub fn change_remote_ussl(&mut self, ussl: bool)

Source

pub fn change_local_host(&mut self, new_host: &str)

Source

pub fn change_local_port(&mut self, new_port: u16)

Source

pub fn change_local_ussl(&mut self, ussl: bool)

Source

pub fn change_modules(&mut self, new_modules: Vec<String>)

Source

pub fn save(&self)

Trait Implementations§

Source§

impl Clone for ConfigEnv

Source§

fn clone(&self) -> ConfigEnv

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConfigEnv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConfigEnv

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ConfigEnv

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ConfigEnv

Source§

fn eq(&self, other: &ConfigEnv) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ConfigEnv

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ConfigEnv

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,