@@ -175,6 +175,11 @@ pub struct ImageProxyConfig {
175
175
/// If set, disable TLS verification. Equivalent to `skopeo --tls-verify=false`.
176
176
pub insecure_skip_tls_verification : Option < bool > ,
177
177
178
+ /// If enabled, propagate debug-logging level from the proxy via stderr to the
179
+ /// current process' stderr. Note than when enabled, this also means that standard
180
+ /// error will no longer be captured.
181
+ pub debug : bool ,
182
+
178
183
/// Provide a configured [`std::process::Command`] instance.
179
184
///
180
185
/// This allows configuring aspects of the resulting child `skopeo` process.
@@ -202,6 +207,7 @@ impl TryFrom<ImageProxyConfig> for Command {
202
207
type Error = Error ;
203
208
204
209
fn try_from ( config : ImageProxyConfig ) -> Result < Self > {
210
+ let debug = config. debug || std:: env:: var_os ( "CONTAINERS_IMAGE_PROXY_DEBUG" ) . is_some ( ) ;
205
211
let mut allocated_fds = RESERVED_FD_RANGE . clone ( ) ;
206
212
let mut alloc_fd = || {
207
213
allocated_fds. next ( ) . ok_or_else ( || {
@@ -223,6 +229,9 @@ impl TryFrom<ImageProxyConfig> for Command {
223
229
c
224
230
} ) ;
225
231
c. arg ( "experimental-image-proxy" ) ;
232
+ if debug {
233
+ c. arg ( "--debug" ) ;
234
+ }
226
235
let auth_option_count = [
227
236
config. authfile . is_some ( ) ,
228
237
config. auth_data . is_some ( ) ,
@@ -276,7 +285,10 @@ impl TryFrom<ImageProxyConfig> for Command {
276
285
if config. insecure_skip_tls_verification . unwrap_or_default ( ) {
277
286
c. arg ( "--tls-verify=false" ) ;
278
287
}
279
- c. stdout ( Stdio :: null ( ) ) . stderr ( Stdio :: piped ( ) ) ;
288
+ c. stdout ( Stdio :: null ( ) ) ;
289
+ if !debug {
290
+ c. stderr ( Stdio :: piped ( ) ) ;
291
+ }
280
292
Ok ( c)
281
293
}
282
294
}
0 commit comments