Skip to content

Commit

Permalink
Merge pull request #2078 from anyproto/go-5000-middleware-publish-to-…
Browse files Browse the repository at this point in the history
…folder

GO-5000 add `ANYTYPE_LOCAL_PUBLISH_DIR` to override publish to server
  • Loading branch information
zarkone authored Feb 3, 2025
2 parents dd63a99 + 1a7f8ce commit 00b0ef5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/publish/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,16 @@ func (s *service) publishToPublishServer(ctx context.Context, spaceId, pageId, u
return err
}

if err := s.publishToServer(ctx, spaceId, pageId, uri, version, tempPublishDir); err != nil {
return err
if localPublishDir := os.Getenv("ANYTYPE_LOCAL_PUBLISH_DIR"); localPublishDir != "" {
err := os.CopyFS(localPublishDir, os.DirFS(tempPublishDir))
if err != nil {
log.Error("publishing to local dir error", zap.Error(err))
return err
}
} else {
if err := s.publishToServer(ctx, spaceId, pageId, uri, version, tempPublishDir); err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit 00b0ef5

Please sign in to comment.