diff --git a/client/internal/debug/debug.go b/client/internal/debug/debug.go index 0a12a5326..06238ab96 100644 --- a/client/internal/debug/debug.go +++ b/client/internal/debug/debug.go @@ -235,6 +235,7 @@ type BundleGenerator struct { syncResponse *mgmProto.SyncResponse logPath string tempDir string + statePath string cpuProfile []byte capturePath string refreshStatus func() // Optional callback to refresh status before bundle generation @@ -259,6 +260,7 @@ type GeneratorDependencies struct { SyncResponse *mgmProto.SyncResponse LogPath string TempDir string // Directory for temporary bundle zip files. If empty, os.TempDir() is used. + StatePath string // Path to the state file. If empty, the ServiceManager default path is used. CPUProfile []byte CapturePath string RefreshStatus func() @@ -280,6 +282,7 @@ func NewBundleGenerator(deps GeneratorDependencies, cfg BundleConfig) *BundleGen syncResponse: deps.SyncResponse, logPath: deps.LogPath, tempDir: deps.TempDir, + statePath: deps.StatePath, cpuProfile: deps.CPUProfile, capturePath: deps.CapturePath, refreshStatus: deps.RefreshStatus, @@ -791,8 +794,11 @@ func (g *BundleGenerator) addSyncResponse() error { } func (g *BundleGenerator) addStateFile() error { - sm := profilemanager.NewServiceManager("") - path := sm.GetStatePath() + path := g.statePath + if path == "" { + sm := profilemanager.NewServiceManager("") + path = sm.GetStatePath() + } if path == "" { return nil } diff --git a/client/ios/NetBirdSDK/client.go b/client/ios/NetBirdSDK/client.go index f9b582ef2..ee9959b0f 100644 --- a/client/ios/NetBirdSDK/client.go +++ b/client/ios/NetBirdSDK/client.go @@ -217,6 +217,7 @@ func (c *Client) DebugBundle(anonymize bool) (string, error) { InternalConfig: cfg, StatusRecorder: c.recorder, TempDir: c.cacheDir, + StatePath: c.stateFile, } if cc != nil {