@@ -52,13 +52,13 @@ func (s *safeStartupHook) Hook(ctx context.Context, runDir, adminAddress string)
5252// - Endpoints (EDS)
5353// - Secrets (SDS)
5454// This provides a comprehensive snapshot of Envoy's dynamic configuration state.
55- func collectConfigDump (ctx context.Context , runDir , adminAddress string ) error {
55+ func collectConfigDump (ctx context.Context , client * http. Client , runDir , adminAddress string ) error {
5656 url := fmt .Sprintf ("http://%s/config_dump?include_eds" , adminAddress )
5757 file := filepath .Join (runDir , "config_dump.json" )
58- return copyURLToFile (ctx , url , file )
58+ return copyURLToFile (ctx , client , url , file )
5959}
6060
61- func copyURLToFile (ctx context.Context , url , fullPath string ) error {
61+ func copyURLToFile (ctx context.Context , client * http. Client , url , fullPath string ) error {
6262 // #nosec -> runDir is allowed to be anywhere
6363 f , err := os .OpenFile (fullPath , os .O_CREATE | os .O_WRONLY , 0o600 )
6464 if err != nil {
@@ -71,7 +71,7 @@ func copyURLToFile(ctx context.Context, url, fullPath string) error {
7171 if err != nil {
7272 return fmt .Errorf ("could not create request %v: %w" , url , err )
7373 }
74- res , err := http . DefaultClient .Do (req )
74+ res , err := client .Do (req )
7575 if err != nil {
7676 return fmt .Errorf ("could not read %v: %w" , url , err )
7777 }
0 commit comments