Skip to main content

greentic_deploy_spec/
adapters.rs

1//! Adapters from legacy types to the new spec.
2//!
3//! `greentic-config-types::EnvironmentConfig` currently carries the host-level
4//! Environment shape. Phase A `EnvironmentHostConfig` is its successor; the
5//! `From` impl below lets callers thread legacy values through unchanged. The
6//! `deployment`/`connection` fields don't have a place in the new host-config —
7//! they belong to `EnvPackBinding[Sessions]` and `EnvPackBinding[Deployer]`
8//! respectively — and are dropped at the adapter boundary. Phase A wizards
9//! reconstruct them from the env-pack registry.
10
11use crate::environment::EnvironmentHostConfig;
12use greentic_config_types::EnvironmentConfig;
13
14impl From<EnvironmentConfig> for EnvironmentHostConfig {
15    fn from(value: EnvironmentConfig) -> Self {
16        Self {
17            env_id: value.env_id,
18            region: value.region,
19            tenant_org_id: None,
20            listen_addr: None,
21            public_base_url: None,
22            gui_enabled: None,
23        }
24    }
25}
26
27impl From<&EnvironmentConfig> for EnvironmentHostConfig {
28    fn from(value: &EnvironmentConfig) -> Self {
29        Self {
30            env_id: value.env_id.clone(),
31            region: value.region.clone(),
32            tenant_org_id: None,
33            listen_addr: None,
34            public_base_url: None,
35            gui_enabled: None,
36        }
37    }
38}