Github CDN offers a Node.js API so you can roll your own instance. You might want to do this to personalize it or configure it to use a Github Enterprise server.
$ npm i github-cdn
import express from 'express';
import cookieParser from 'cookie-parser';
import githubCdnRouter from 'github-cdn';
const app = express();
...
// For parsing the custom token
app.use(cookieParser());
app.use(githubCdnRouter());
...
app.listen(...);
Github CDN points at the public Github by default, but you can configure it to point to a Github Enterprise, use memcached, or add a whitelist.
The configuration file is detected and read using cosmicconfig to support various config naming conventions (eg. .githubcdnrc.js
, githubcdn.config.js
).
-
github
(Object
)base
(String
) - Github URL (default:https://github.com
)apiBase
(String
) - Github API URL (default:https://api.github.com
)token
(String
) - Github API token
-
landingPageMdSrc
(String
) - URL of a Markdown file to render on the landing page (default: Github CDN readme.md) -
memcached
(String
) - Memcachedhost:port
(eg.localhost:11211
)Tip: Set a higher storage limit via
memcached -I 10m
-
whitelist
(Array<Object>
) - Only allow access to specific reposowner
(String
) - Owner of the repo to whitelistrepo
(String
) - Name of the repo to whitelistgists
(Boolean
) - Whether the owner's Gists are accessible