Skip to content

Commit

Permalink
chore(server): enable renderer for all deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
forehalo committed Sep 18, 2024
1 parent fab23d2 commit dbb3c0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 9 additions & 4 deletions .github/helm/affine/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,20 @@ spec:
name: affine-graphql
port:
number: {{ .Values.graphql.service.port }}
{{- if eq .Values.global.app.buildType "canary" }}
- path: /workspace
- path: /workspace/([^/]+)/(home|all|search|collection|tag|trash)
pathType: ImplementationSpecific
backend:
service:
name: affine-web
port:
number: {{ .Values.web.service.port }}
- path: /workspace/([^/]+)/.+
pathType: Prefix
backend:
service:
name: affine-renderer
port:
number: {{ .Values.graphql.service.port }}
{{- end }}
number: {{ .Values.renderer.service.port }}
- path: /
pathType: Prefix
backend:
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/server/src/core/doc-renderer/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const defaultAssets: HtmlAssets = {
description: '',
};

@Controller('/workspace/:workspaceId/:docId')
@Controller('/workspace')
export class DocRendererController {
private readonly logger = new Logger(DocRendererController.name);
private readonly webAssets: HtmlAssets = defaultAssets;
Expand Down Expand Up @@ -68,7 +68,7 @@ export class DocRendererController {
}

@Public()
@Get()
@Get('/:workspaceId/:docId')
async render(
@Req() req: Request,
@Res() res: Response,
Expand All @@ -87,7 +87,7 @@ export class DocRendererController {
try {
opts =
workspaceId === docId
? await this.renderWorkspace(workspaceId)
? await this.getWorkspaceContent(workspaceId)
: await this.getPageContent(workspaceId, docId);
metrics.doc.counter('render').add(1);
} catch (e) {
Expand Down Expand Up @@ -123,7 +123,7 @@ export class DocRendererController {
return null;
}

private async renderWorkspace(
private async getWorkspaceContent(
workspaceId: string
): Promise<RenderOptions | null> {
const allowUrlPreview = await this.permission.allowUrlPreview(workspaceId);
Expand Down

0 comments on commit dbb3c0d

Please sign in to comment.