MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / resolve_squid_conf_path

Method resolve_squid_conf_path

src/context/tsk_config.rs:83–121  ·  view source on GitHub ↗

Resolves squid_conf_path to file content, checking config layers in priority order. Within each layer, squid_conf (already merged as scalar) takes priority over squid_conf_path.

(
        &self,
        project_name: &str,
        project_config: Option<&SharedConfig>,
        project_root: Option<&Path>,
    )

Source from the content-addressed store, hash-verified

81 /// Resolves squid_conf_path to file content, checking config layers in priority order.
82 /// Within each layer, squid_conf (already merged as scalar) takes priority over squid_conf_path.
83 fn resolve_squid_conf_path(
84 &self,
85 project_name: &str,
86 project_config: Option<&SharedConfig>,
87 project_root: Option<&Path>,
88 ) -> Option<String> {
89 // Priority order: user [project.<name>] > project .tsk/tsk.toml > user [defaults]
90
91 // User project-specific config
92 if let Some(config) = self.project.get(project_name)
93 && let Some(ref path_str) = config.squid_conf_path
94 && let Some(content) = try_read_squid_conf(&expand_tilde(path_str))
95 {
96 return Some(content);
97 }
98
99 // Project-level .tsk/tsk.toml config
100 if let Some(config) = project_config
101 && let Some(ref path_str) = config.squid_conf_path
102 {
103 let path = if let Some(root) = project_root {
104 root.join(path_str)
105 } else {
106 PathBuf::from(path_str)
107 };
108 if let Some(content) = try_read_squid_conf(&path) {
109 return Some(content);
110 }
111 }
112
113 // User defaults
114 if let Some(ref path_str) = self.defaults.squid_conf_path
115 && let Some(content) = try_read_squid_conf(&expand_tilde(path_str))
116 {
117 return Some(content);
118 }
119
120 None
121 }
122
123 /// Apply a SharedConfig layer onto a ResolvedConfig with proper merge semantics.
124 ///

Callers 1

resolve_configMethod · 0.80

Calls 2

try_read_squid_confFunction · 0.85
expand_tildeFunction · 0.85

Tested by

no test coverage detected