File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 11package restic
22
33import (
4+ "fmt"
45 shell "github.com/codeskyblue/go-sh"
56 ofst "kmodules.xyz/offshoot-api/api/v1"
7+ "os"
8+ "path/filepath"
69 "stash.appscode.dev/stash/apis/stash/v1alpha1"
710)
811
@@ -97,6 +100,28 @@ func (w *ResticWrapper) SetEnv(key, value string) {
97100 }
98101}
99102
103+ func (w * ResticWrapper ) DumpEnv (path string , resticEnvs string ) error {
104+ if err := os .MkdirAll (path , 0755 ); err != nil {
105+ return err
106+ }
107+
108+ file , err := os .Create (filepath .Join (path , resticEnvs ))
109+ if err != nil {
110+ return err
111+ }
112+
113+ if w .sh != nil {
114+ for k ,v := range w .sh .Env {
115+ kv := fmt .Sprintf ("%s=%s\n " , k , v )
116+ _ , err = file .Write ([]byte (kv ))
117+ if err != nil {
118+ return err
119+ }
120+ }
121+ }
122+ return nil
123+ }
124+
100125func (w * ResticWrapper ) HideCMD () {
101126 if w .sh != nil {
102127 w .sh .ShowCMD = false
You can’t perform that action at this time.
0 commit comments