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 }
23 }
24}
25
26impl From<&EnvironmentConfig> for EnvironmentHostConfig {
27 fn from(value: &EnvironmentConfig) -> Self {
28 Self {
29 env_id: value.env_id.clone(),
30 region: value.region.clone(),
31 tenant_org_id: None,
32 listen_addr: None,
33 public_base_url: None,
34 }
35 }
36}