Skip to main content

try_from_env

Function try_from_env 

Source
pub fn try_from_env() -> Result<Option<ServiceBinding>, ServiceBindingError>
Expand description

Tries to discover an AgentVisor service binding from the environment.

The function checks VCAP_SERVICES first. If that variable is not set, it falls back to file-based bindings under the directory named by SERVICE_BINDING_ROOT (defaulting to /platform/bindings).

Returns Ok(None) when no binding is found. Returns an error when a binding is present but malformed (missing or empty required fields, ambiguous matches, invalid JSON).