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    pub fn cli_name(&self) -> &str {
24        &self.cli
25    }
26
27    /// Wire SecretsManager state so `secrets[].valueFrom` entries
28    /// pointing at SecretsManager ARNs resolve at task launch.
29    pub fn with_secretsmanager(mut self, state: SharedSecretsManagerState) -> Self {
30        self.secretsmanager_state = Some(state);
31        self
32    }
33
34    /// Wire SSM state so `secrets[].valueFrom` entries pointing at
35    /// Parameter Store ARNs resolve at task launch.
36    pub fn with_ssm(mut self, state: SharedSsmState) -> Self {
37        self.ssm_state = Some(state);
38        self
39    }
40}