This is consistent with what we're pretty much already doing, and saves us from making the request during code review.
These were all autofixed and most of them seem easier to read. Some in the legacy services should be rewritten in more legible forms during refactor (ie using intermediate variables, or using request’s qs option). There are some in helper functions and elsewhere that should get rewritten separately. I don't want to change them in this PR because the changes will get lost in this diff, though we could identify them here and fix them before or just after.
I had to track down the right lint rule for this. We have no-useless-rename for destructuring and import/export. The one for object literals is object-shorthand.
Instead of saving tokens on a timer, save them when they change. Use EventEmitter to keep the components loosely coupled.
This is easier to reason about, much easier to test, and better supports adapting to backends which support atomic operations.
This replaces json-autosave, which was a bit difficult to read and also hard to test, with fsos, the lower-level utility it’s built on.
Ref: #1848
We use arrow functions in most places; this enforces it.
Passing arrow functions to Mocha is discouraged: https://mochajs.org/#arrow-functions
This was a mix of autofixes and hand adjustments.
This creates a new convenience class which consolidates all the Github initialization. It supports dependency injection and facilitates refactoring the persistence along the lines of #1205.
Also ref #1848
- Periodically log github auth information
- Tokens are hashed which reduces the security risk inherent in the logs
- A consistent hash is used so tokens can be correlated across the three data structures and across the three servers
- Add an admin endpoint for github auth information
- Tokens are returned as-is to enable troubleshooting (e.g. comparing our reqRemaining to github’s)
This fixes a bug introduced in 076cb14, wherein we discarded tokens received
from other servers, and wherein we could save tokens with invalid
identification.
The bug was raised by Paul Melnikow.
I developed this for #820 to provide the correct cache behavior when a service wants to use custom parameters from the query string.
For safety, only the declared parameters (and the global parameters) are provided to the service. Consequently, failure to declare a parameter results in the parameter not working at all (undesirable, but easy to debug) rather than indeterminate behavior that depends on the cache state (undesirable, but hard to debug).
- Add tests to request-handler to prepare for some tweaks to caching for #820
- Clean up code in request-handler: renames, DRY, arrows, imports
- Allow for clean shutdown of `setInterval` code. This requires the ability to cancel autosaving.
- Upgrade to Mocha 4, and clean up so the process exits on its own (see mochajs/mocha#3044)
- Better encapsulate analytics
It seems like a mistake from #870. Indeed, the code in that patch
defaults to shields.io for BASE_URL, but the author mentions they
think it defaults to img.shields.io: https://github.com/badges/shields/pull/870#discussion_r115143960
The correct value to maintain the behavior that was present prior
to the patch in question was indeed img.shields.io.
Because I despise nitpicking stuff like indentation and spacing in pull request comments, I'd like to nudge forward our automated style checking, at least for new files being added.
I don't want to totally rewrite server.js just to get automated style checking… the blame tracking is just too useful. So let's it's just take care of that when we start splitting it out.
More discussion in #948.
* Add template for secret.json
- Move to faster and lighter Alpine base image
* Update documentation
* Update documentation
* Fix Github token config for secret.json
* Extend env file for Docker runtime configuration
- Update documentation
- Add gh_token for GH personal access token to secret template
* Change http to https in infoSite
* Update .dockerignore
* Update .gitignore
* Update dockerignore
* Remove ENV directive from Dockerfile
- Environment is needed at runtime, not at buildtime
* Docker: contain secret.json in private/
- Incorporates fix from 7c8b0e3d
* Use localhost in example env
* Use baseUrl in GitHub redirect
* Move GH personal token retrieval up
- To remove duplicate Promise.then()
* Typo in shields.example.env