Skip to content

markusahlstrand/cloudproxy-swagger-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open-api is really cool and swagger-ui is awesome, but hosting it is a bit tricky as most npm packages don't support all the swagger-ui features such as authentication.

This repo uploads the static files to Cloudflare KV-Storage so that they can be served directly through cloudflare using the Cloudworker Proxy

Usage

The easiest way to use this repo is probably to fork it and modify the index.html doc in the src folder. Add a .env file in the root with the following values:

  • CLOUDFLARE_ACCOUNT_ID
  • CLOUDFLARE_ZONE_ID
  • CLOUDFLARE_AUTH_KEY
  • CLOUDFLARE_AUTH_EMAIL
  • KV_NAMESPACE

Run npm run upload to upload the files to KV-Storage

Add the following rule to the cloudworker proxy:

const rules = [{
  host: "docs.example.:host",
  handlerName: "kvStorage",
  options: {
  kvAccountId: <kvAccountId>,
  kvNamespace: <kvNamespace>,
  kvAuthEmail: <authEmail>,
  kvAuthKey: <authKey>,
  kvBasePath: "docs/",
  defaultIndexDocument: "index.html",
}];

About

An upload tool for swagger-ui so it can be served from cloudflare workers using the cloudworker-proxy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •