Skip to content

Commit

Permalink
Contain all private files in private/
Browse files Browse the repository at this point in the history
  • Loading branch information
espadrine committed Feb 5, 2017
1 parent efc9ce8 commit 7c8b0e3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
/coverage.html
/redis
/ServerScript
/secret.json
/.github-user-tokens.json
/private

# Installed npm modules
node_modules
Expand Down
7 changes: 3 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Successfully built 4471b442c220
Then run the container:

```console
$ docker run --rm -p 8080:80 -v "$(pwd)/secret.json":/usr/src/app/secret.json --name shields shields
$ docker run --rm -p 8080:80 -v "$(pwd)/private/secret.json":/usr/src/app/secret.json --name shields shields

> gh-badges@1.1.2 start /usr/src/app
> node server.js
Expand All @@ -149,21 +149,20 @@ Assuming Docker is running locally, you should be able to get to the application

# Secret.json

Some services require the use of secret tokens or passwords. Those are stored in a file called `secret.json` that is not checked into the repository, to avoid impersonation. Here is how it currently looks like:
Some services require the use of secret tokens or passwords. Those are stored in `private/secret.json` which is not checked into the repository, to avoid impersonation. Here is how it currently looks like:

```
bintray_apikey
bintray_user
gh_client_id
gh_client_secret
gitter_dev_secret
shieldsIps
shieldsSecret
sl_insight_apiToken
sl_insight_userUuid
```

(Gathered from `cat secret.json | jq keys | grep -o '".*"' | sed 's/"//g'`.)
(Gathered from `cat private/secret.json | jq keys | grep -o '".*"' | sed 's/"//g'`.)

# Main Server Sysadmin

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ deploy: deploy-s0 deploy-s1 deploy-gh-pages

deploy-s0:
git add -f Verdana.ttf
git add -f secret.json
git add -f private/secret.json
git commit -m'MUST NOT BE ON GITHUB'
git push -f s0 HEAD:master
git reset HEAD~1
git checkout master

deploy-s1:
git add -f Verdana.ttf
git add -f secret.json
git add -f private/secret.json
git commit -m'MUST NOT BE ON GITHUB'
git push -f s1 HEAD:master
git reset HEAD~1
Expand All @@ -46,7 +46,7 @@ deploy-gh-pages:

deploy-heroku:
git add -f Verdana.ttf
git add -f secret.json
git add -f private/secret.json
git commit -m'MUST NOT BE ON GITHUB'
git push -f heroku HEAD:master
git reset HEAD~1
Expand Down
4 changes: 2 additions & 2 deletions lib/github-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ var serverSecrets;
try {
// Everything that cannot be checked in but is useful server-side
// is stored in this JSON data.
serverSecrets = require('../secret.json');
serverSecrets = require('../private/secret.json');
} catch(e) {}
var githubUserTokens;
var githubUserTokensFile = '.github-user-tokens.json';
var githubUserTokensFile = './private/github-user-tokens.json';
autosave(githubUserTokensFile, {data:[]}).then(function(f) {
githubUserTokens = f;
for (var i = 0; i < githubUserTokens.data.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"chrome-web-store-item-property": "~1.1.2",
"dot": "~1.0.3",
"gm": "^1.23.0",
"json-autosave": "~1.1.1",
"json-autosave": "~1.1.2",
"pdfkit": "~0.8.0",
"redis": "~2.6.2",
"request": "~2.75.0",
Expand Down
6 changes: 4 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ var serverSecrets;
try {
// Everything that cannot be checked in but is useful server-side
// is stored in this JSON data.
serverSecrets = require('./secret.json');
} catch(e) { console.error('No secret data (secret.json, see server.js):', e); }
serverSecrets = require('./private/secret.json');
} catch(e) {
console.error('No secret data (private/secret.json, see server.js):', e);
}
if (serverSecrets && serverSecrets.gh_client_id) {
githubAuth.setRoutes(camp);
}
Expand Down
6 changes: 4 additions & 2 deletions suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ var serverSecrets;
try {
// Everything that cannot be checked in but is useful server-side
// is stored in this JSON data.
serverSecrets = require('./secret.json');
} catch(e) { console.error('No secret data (secret.json, see server.js):', e); }
serverSecrets = require('./private/secret.json');
} catch(e) {
console.error('No secret data (private/secret.json, see server.js):', e);
}

// data: {url}, JSON-serializable object.
// end: function(json), with json of the form:
Expand Down

0 comments on commit 7c8b0e3

Please sign in to comment.