Skip to content

Commit

Permalink
chore: change the way we delete un-needed files
Browse files Browse the repository at this point in the history
  • Loading branch information
MightyMoud committed Oct 24, 2024
1 parent a204a5c commit 1858c7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/preview/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ var PreviewCmd = &cobra.Command{
panic(envErr)
}
}
defer os.Remove("encrypted.env")

imageName := fmt.Sprintf("%s:%s", appConfig.Name, deployHash)
serviceName := fmt.Sprintf("%s-%s", appConfig.Name, deployHash)
Expand Down Expand Up @@ -144,7 +143,6 @@ var PreviewCmd = &cobra.Command{
fmt.Printf("Error writing file: %v\n", err)
return
}
defer os.Remove("docker-compose.yaml")

cwd, _ := os.Getwd()
dockerImage := fmt.Sprintf("%s:%s", appConfig.Name, deployHash)
Expand Down Expand Up @@ -186,7 +184,6 @@ var PreviewCmd = &cobra.Command{
if imgMovCmdErr := imgMoveCmd.Run(); imgMovCmdErr != nil {
p.Send(render.ErrorMsg{})
}
defer os.Remove(imgFileName)

time.Sleep(time.Millisecond * 200)

Expand Down Expand Up @@ -247,6 +244,11 @@ var PreviewCmd = &cobra.Command{

ymlData, _ := yaml.Marshal(&appConfig)
os.WriteFile("./sidekick.yml", ymlData, 0644)

os.Remove("docker-compose.yaml")
os.Remove("encrypted.env")
os.Remove(imgFileName)

p.Send(render.AllDoneMsg{Duration: time.Since(start).Round(time.Second), URL: previewURL})
}()

Expand Down

0 comments on commit 1858c7d

Please sign in to comment.