Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/web.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var express = require('express');
var getenv = require('getenv');
var uuid = require('uuid');
var basicAuth = require('basic-auth');
var Analytics = require('analytics-node');
Expand All @@ -19,13 +20,14 @@ if (process.env.ANALYTICS_TOKEN) {

var myNuts = nuts.Nuts({
repository: process.env.GITHUB_REPO,
anonymous: getenv.boolish('GITHUB_ANONYMOUS', false),
token: process.env.GITHUB_TOKEN,
username: process.env.GITHUB_USERNAME,
password: process.env.GITHUB_PASSWORD,
timeout: process.env.VERSIONS_TIMEOUT,
cache: process.env.VERSIONS_CACHE,
refreshSecret: process.env.GITHUB_SECRET,
proxyAssets: !Boolean(process.env.DONT_PROXY_ASSETS)
proxyAssets: !getenv.boolish('DONT_PROXY_ASSETS', false)
});

// Control access to API
Expand Down
4 changes: 3 additions & 1 deletion docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ This service requires to be configured using environment variables:
$ export PORT=6000

# Access token for the GitHub API (requires permissions to access the repository)
# If the repository is public you do not need to provide an access token
# you can also use GITHUB_USERNAME and GITHUB_PASSWORD
$ export GITHUB_TOKEN=...

# Or, if the repository is public you do not need to provide an access token
$ export GITHUB_ANONYMOUS=1

# ID for the GitHub repository
$ export GITHUB_REPO=Username/MyApp

Expand Down
4 changes: 2 additions & 2 deletions lib/backends/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function GitHubBackend() {
proxyAssets: true
});

if ((!this.opts.username || !this.opts.password) && (!this.opts.token)) {
throw new Error('GitHub backend require "username" and "token" options');
if ((!this.opts.username || !this.opts.password) && (!this.opts.token) && (!this.opts.anonymous)) {
throw new Error('GitHub backend requires either the "username" and "password, "token", or "anonymous" option');
}

this.client = new GitHub({
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"express": "^4.13.3",
"express-useragent": "0.1.9",
"feed": "^0.3.0",
"getenv": "^0.6.0",
"github-webhook-handler": "0.5.0",
"lodash": "3.7.0",
"lru-diskcache": "1.1.1",
Expand Down