Skip to main content

fakecloud_ecs/runtime/
config.rs

1//! `EcsRuntime` `config` family — extracted from service.rs by audit-2026-05-19.
2
3use super::*;
4
5impl EcsRuntime {
6    /// Path suitable for `DOCKER_CONFIG`. `None` if the tempdir setup
7    /// failed; in that case pulls fall back to the user's own config and
8    /// will only work if they've already logged in.
9    pub(super) fn docker_config_path(&self) -> Option<PathBuf> {
10        self.docker_config.as_ref().map(|d| d.path().to_path_buf())
11    }
12
13    /// Build a `Command` for the container CLI with `DOCKER_CONFIG` set
14    /// to our isolated tempdir so fakecloud ECR auth works out of the box.
15    pub(super) fn cli_command(&self) -> Command {
16        let mut cmd = Command::new(&self.cli);
17        if let Some(p) = self.docker_config_path() {
18            cmd.env("DOCKER_CONFIG", p);
19        }
20        cmd
21    }
22
23    /// Wire SecretsManager state so `secrets[].valueFrom` entries
24    /// pointing at SecretsManager ARNs resolve at task launch.
25    pub fn with_secretsmanager(mut self, state: SharedSecretsManagerState) -> Self {
26        self.secretsmanager_state = Some(state);
27        self
28    }
29
30    /// Wire SSM state so `secrets[].valueFrom` entries pointing at
31    /// Parameter Store ARNs resolve at task launch.
32    pub fn with_ssm(mut self, state: SharedSsmState) -> Self {
33        self.ssm_state = Some(state);
34        self
35    }
36}