Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self host redoc #284

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

Zanda256
Copy link

@Zanda256 Zanda256 commented Feb 6, 2025

With this change, we download and host the latest Redoc script every time we generate a backend.

Resolves #38

Checklist

  • I have read the contribution guide.
  • I have not used an AI coding assistant to create this PR.
  • My contribution is compatible with the MPL-2.0 license and I have provided a DCO sign-off on all my commits.
  • I have written all code in this PR myself OR I have marked all code I have not written myself (including modified code, e.g. copied from other places and then modified) with a comment indicating where it came from.

Copy link
Collaborator

@abstractionfactory abstractionfactory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, a few more things just caught my eye.

backend/internal/tools/pull-redoc/main.go Outdated Show resolved Hide resolved
backend/internal/server/redoc.standalone.js Show resolved Hide resolved
backend/internal/tools/pull-redoc/main.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@abstractionfactory abstractionfactory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Zanda256 looking good! Let's add the SHA256 checksum explicitly to the pull tool as a command line argument and we'll record it the first time we download it in the go:generate command.

@@ -44,5 +46,10 @@ func (w writer) Write(ctx context.Context) error {
if err := w.storage.WriteFile(ctx, "index.html", indexHTML); err != nil {
return err
}

if err := w.storage.WriteFile(ctx, "redoc.standalone.js", reDocScriptFile); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also write record.standalone.js.LICENSE.txt here.

}

// Pull ReDoc LICENSE file
licenseFileURL := "https://raw.githubusercontent.com/Redocly/redoc/refs/heads/main/LICENSE"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should pull from https://cdn.redoc.ly/redoc/VERSION/bundles/redoc.standalone.js.LICENSE.txt, not from the Git repo as it may change over versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Self-host ReDoc
2 participants