summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-15 17:44:46 -0800
committerClawd <ai@clawd.bot>2026-02-15 17:44:46 -0800
commit4b5a2656df13181b637c59c29ff31751e11cf22a (patch)
tree9527a6229e4ac21c4fd25ca39e0de595566c4919
parent933a5f6f8c39c0aaed59fae6a649748825c7c7de (diff)
fix: use project directory for static site .ship/ foldermain
Previously, deployStatic() checked for .ship/Caddyfile in the current working directory instead of the project directory (opts.Dir). This caused stale Caddyfiles from previous deployments to be reused when deploying multiple static sites from the same working directory. Now .ship/ is created inside the project directory, so each site maintains its own configuration.
-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 }