summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ship/deploy.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/cmd/ship/deploy.go b/cmd/ship/deploy.go
index 90dc846..414ade5 100644
--- a/cmd/ship/deploy.go
+++ b/cmd/ship/deploy.go
@@ -586,9 +586,12 @@ func deployStatic(st *state.State, opts DeployOptions) error {
586 586
587 // Create local .ship directory and Caddyfile for static sites if it doesn't exist 587 // Create local .ship directory and Caddyfile for static sites if it doesn't exist
588 // (handles both initial deployment and migration of existing deployments) 588 // (handles both initial deployment and migration of existing deployments)
589 if _, err := os.Stat(".ship/Caddyfile"); os.IsNotExist(err) { 589 shipDir := filepath.Join(opts.Dir, ".ship")
590 caddyfilePath := filepath.Join(shipDir, "Caddyfile")
591
592 if _, err := os.Stat(caddyfilePath); os.IsNotExist(err) {
590 fmt.Println("-> Creating local .ship directory...") 593 fmt.Println("-> Creating local .ship directory...")
591 if err := os.MkdirAll(".ship", 0755); err != nil { 594 if err := os.MkdirAll(shipDir, 0755); err != nil {
592 return fmt.Errorf("error creating .ship directory: %w", err) 595 return fmt.Errorf("error creating .ship directory: %w", err)
593 } 596 }
594 597
@@ -600,14 +603,14 @@ func deployStatic(st *state.State, opts DeployOptions) error {
600 if err != nil { 603 if err != nil {
601 return fmt.Errorf("error generating Caddy config: %w", err) 604 return fmt.Errorf("error generating Caddy config: %w", err)
602 } 605 }
603 if err := os.WriteFile(".ship/Caddyfile", []byte(caddyContent), 0644); err != nil { 606 if err := os.WriteFile(caddyfilePath, []byte(caddyContent), 0644); err != nil {
604 return fmt.Errorf("error writing .ship/Caddyfile: %w", err) 607 return fmt.Errorf("error writing .ship/Caddyfile: %w", err)
605 } 608 }
606 } 609 }
607 610
608 // Upload Caddyfile from .ship/Caddyfile 611 // Upload Caddyfile from .ship/Caddyfile
609 fmt.Println("-> Installing Caddy config...") 612 fmt.Println("-> Installing Caddy config...")
610 caddyContent, err := os.ReadFile(".ship/Caddyfile") 613 caddyContent, err := os.ReadFile(caddyfilePath)
611 if err != nil { 614 if err != nil {
612 return fmt.Errorf("error reading .ship/Caddyfile: %w", err) 615 return fmt.Errorf("error reading .ship/Caddyfile: %w", err)
613 } 616 }