Skip to main content

EngineConfig

Struct EngineConfig 

Source
pub struct EngineConfig {
Show 15 fields pub node_bin: PathBuf, pub agent_path: PathBuf, pub mode: String, pub device_token: String, pub relay_addr: String, pub control_plane: String, pub local_port: u16, pub mgmt_secret: String, pub frp_token: Option<String>, pub frpc_bin: Option<PathBuf>, pub cert_mode: Option<String>, pub first_party_app: Option<String>, pub engine_version: Option<String>, pub work_dir: Option<PathBuf>, pub mgmt_port: Option<u16>,
}
Expand description

Everything needed to launch a bundled engine. The host resolves the paths (from its Tauri resources / sidecars) and the credential, then hands them off.

Fields§

§node_bin: PathBuf

Program to run (the bundled Node runtime, or "node" in dev).

§agent_path: PathBuf

The bundled agent.mjs.

§mode: String

--mode (usually "portal").

§device_token: String

Per-device credential (env AGENT_DEVICE_TOKEN — never argv).

§relay_addr: String

--relay-addr (may be host or host:port).

§control_plane: String

--control-plane URL.

§local_port: u16

--local-port the agent serves on (default 8443).

§mgmt_secret: String

Owner-tier secret (env AGENT_MGMT_SECRET — never argv).

§frp_token: Option<String>

Relay token (env AGENT_FRP_TOKEN — never argv; omitted when empty).

§frpc_bin: Option<PathBuf>

--frpc-bin — the pinned sidecar (omitted in dev / with an override).

§cert_mode: Option<String>

--cert-mode (acme in release; None keeps the agent’s static default).

§first_party_app: Option<String>

--first-party-app — auto-approve this app’s own publish (embeds only).

§engine_version: Option<String>

--engine-version — stamp reported by /engine/info (from bundle.json).

§work_dir: Option<PathBuf>

--work-dir — private state dir (None = platform default).

§mgmt_port: Option<u16>

--mgmt-port — override the default 8765 (None = default).

Implementations§

Source§

impl EngineConfig

Source

pub fn portal( node_bin: PathBuf, agent_path: PathBuf, device_token: String, relay_addr: String, control_plane: String, mgmt_secret: String, ) -> Self

A minimal portal-mode config; fill in the optionals as needed.

Source

pub fn to_args(&self) -> Vec<String>

Build the agent argument vector (everything after the program + agent.mjs). Optional flags are emitted only when set, so a bare config produces exactly the flags a plain portal agent needs.

SECRETS ARE NEVER HERE. argv is world-readable on the machine (ps, Activity Monitor), so the device token, relay token, and mgmt secret travel via [to_envs] instead — the agent’s arg() helper already falls back to AGENT_<NAME> env vars, and older agents that only read argv simply never receive them from THIS launcher (they get them from their own, older launcher).

Source

pub fn to_envs(&self) -> Vec<(String, String)>

The secrets, as env vars for the agent’s AGENT_<NAME> fallback — invisible to ps, unlike argv. Empty values are skipped: the agent’s own defaults for them are empty too, so absence means the same thing.

Source

pub fn command(&self) -> Command

Build the spawn Command (program + agent.mjs + args + secret envs). The caller may still set stdio, extra env, and platform creation flags before spawning.

Source

pub fn spawn(&self) -> Result<Child>

Spawn the engine, inheriting null stdio unless the caller sets it first.

Source

pub fn mgmt_base(&self) -> String

The management base URL this config’s engine will listen on.

Trait Implementations§

Source§

impl Clone for EngineConfig

Source§

fn clone(&self) -> EngineConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for EngineConfig

Source§

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

Formats the value using the given formatter. Read more

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.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> 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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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