pub struct EnvironmentsConfig {
pub dev: EnvironmentConfig,
pub staging: Option<EnvironmentConfig>,
pub prod: EnvironmentConfig,
}Expand description
Environment-specific configuration
Allows configuring different URLs for dev, staging, and production environments. The active environment is determined by:
MECHA10_ENVenvironment variable--envCLI flag- Default: “dev” when running
mecha10 dev, “prod” otherwise
Fields§
§dev: EnvironmentConfigDevelopment environment (local control plane)
staging: Option<EnvironmentConfig>Staging environment (optional)
prod: EnvironmentConfigProduction environment (cloud control plane)
Implementations§
Source§impl EnvironmentsConfig
impl EnvironmentsConfig
Sourcepub fn get(&self, env: &str) -> Option<&EnvironmentConfig>
pub fn get(&self, env: &str) -> Option<&EnvironmentConfig>
Get the environment config for the given environment name
Sourcepub fn current(&self) -> &EnvironmentConfig
pub fn current(&self) -> &EnvironmentConfig
Get the current environment config based on MECHA10_ENV
Sourcepub fn current_env_name(&self) -> String
pub fn current_env_name(&self) -> String
Resolve the name of the currently active environment (“dev”/“staging”/“prod”/etc), per
the precedence documented on this struct: the MECHA10_ENV environment variable, falling
back to “dev” when unset. This is the single source of truth for “which environment is
active” - current() above and callers that need to forward the resolved name itself
(rather than the EnvironmentConfig it maps to) - e.g. mecha10 run robot setting
MECHA10_ENV on the spawned project binary (LAB-1804) - should go through this instead of
re-reading MECHA10_ENV (or worse, hardcoding a literal) themselves.
Sourcepub fn control_plane_url(&self) -> String
pub fn control_plane_url(&self) -> String
Get the control plane URL for the current environment
Sourcepub fn dashboard_url(&self) -> String
pub fn dashboard_url(&self) -> String
Get the dashboard URL for the current environment Derived: {control_plane}/dashboard
Sourcepub fn relay_url(&self) -> String
pub fn relay_url(&self) -> String
Get the WebRTC relay URL for the current environment Derived: ws(s)://{control_plane_host}/webrtc-relay Note: This is for WebRTC camera signaling. The websocket-bridge node config uses ${CONTROL_PLANE_URL}/ws-relay for general messaging.
Sourcepub fn disk_logging_enabled(&self) -> bool
pub fn disk_logging_enabled(&self) -> bool
Whether disk-based logging is enabled for the current environment (LAB-2041).
Resolves environments.<current_env>.logging.disk_logging_enabled, defaulting to
true when the current environment has no logging section at all (see
EnvironmentConfig::disk_logging_enabled). “Current environment” is whatever
Self::current_env_name resolves to - same precedence as Self::current,
which this delegates to.
Trait Implementations§
Source§impl Clone for EnvironmentsConfig
impl Clone for EnvironmentsConfig
Source§fn clone(&self) -> EnvironmentsConfig
fn clone(&self) -> EnvironmentsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EnvironmentsConfig
impl Debug for EnvironmentsConfig
Source§impl Default for EnvironmentsConfig
impl Default for EnvironmentsConfig
Source§fn default() -> EnvironmentsConfig
fn default() -> EnvironmentsConfig
Source§impl<'de> Deserialize<'de> for EnvironmentsConfig
impl<'de> Deserialize<'de> for EnvironmentsConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EnvironmentsConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EnvironmentsConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for EnvironmentsConfig
impl Serialize for EnvironmentsConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for EnvironmentsConfig
impl RefUnwindSafe for EnvironmentsConfig
impl Send for EnvironmentsConfig
impl Sync for EnvironmentsConfig
impl Unpin for EnvironmentsConfig
impl UnsafeUnpin for EnvironmentsConfig
impl UnwindSafe for EnvironmentsConfig
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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