* update terminology
- "regular update" to "cached resource"
- "interval" to "ttl"
- move file and update imports
* set a default TTL, don't explicitly pass params if we want the default
* add tests
* update docs
* expose fetchLimitBytes/userAgent in got-config module
* export a function not a factory
* send better user-agent values
- add userAgentBase setting
- send short SHA in user agent on heroku
- set a version (tag or short SHA) in Dockefile and use
it to report server version in UA for docker users
* add a comment explaining fileSize
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* feat: support authentication on Libraries.io requests
* feat: wire up libraries.io config and api provider instantiation
* feat: create libraries.io and bower base classes
* refactor: tweak libraries/bower service classes and tests
* rename request fetcher function/arg
* throw exception when no tokens available
* cleanup old value
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* service: add obs service
* service: obs: replaced replaceAll with replace and global regex
* service: obs: added space between class members
* service: obs: support for multiple instances
* service: obs: removed user prefix from auth vars
obs_userName is now called obs_user and obs_userPass is called obs_pass
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
* service: obs: removed constructor hack in favour of serviceKey
* service: obs: apply suggestions from @calebcartwright
* service: obs: remove unneccesary http status mappings
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* Added GitLab Tag service
* Added prettyMessage for when repo has no tags
* Added pretty message for repo not found
* core: esm-ify gitlab tag service
* feat: support gitlab auth
* feat: support custom gitlab url on tag badges
* tests: add auth test for gitlab
* docs: fix gitlab config key references
* feat: support gitlab tag sorting options
* docs: add custom gitlab instance example for tags badge
* use v in gitlab route
* fix: gitlab tag examples
Co-authored-by: Ideotec <guille@ideotec.es>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* Revert "send custom user agent when using got (#6256)"
This reverts commit fd7eddc7bb.
* Revert "Migrate request to got (part 1 of many) (#6160)"
This reverts commit 2359eb278b.
* install got as a prod dependency, allow npm 7
* install new packages
* migrate request to got
* update dynamic json test
This is a behavioural difference between request and got
request will send the request, then we'll get a
`400 Bad Request` back and re-throw at as invalid
got will pick up that the URL is invalid and throw
`RequestError: URI malformed` before attempting to send it
which we'll re-throw as inaccessible
* fix OPM service
* fix wordpress querystring
Got doesn't natively support assmebling a querystring
from nested objects because it uses node's URLSearchParams
internally. Use qs and pass qs a string.
Wordpress is the only service that needs this,
so we could build the string manually in this case
if we don't want to take qs as a prod dependency.
It is mostly hard-coded values anyway.
* fix wercker
got overwrites any ?foo=bar in the URL string if
searchParams is also passed whereas request appends
see https://github.com/sindresorhus/got#url
* fix keybase
* add tests for got wrapper
* bootstrap global agent in server start
* [Bitbucket Server] Adding Auth Tokens and Resolving Pull Request api issue. Added the bitbucket_server_username & bitbucket_server_password variables to the /core/server/server.js file. Also changed the user variable in the /services/bitbucket/bitbucket/bitbucket-pull-request.service.js the api documentation (https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287391664) defines the parameter as requiring the project name that the repository is contained in not the user name.
* [Bitbucket Server] Adding Auth Tokens and Resolving Pull Request api issue. Added the bitbucket_server_username & bitbucket_server_password variables to the /core/server/server.js file. Also changed the user variable in the /services/bitbucket/bitbucket/bitbucket-pull-request.service.js the api documentation (https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287391664) defines the parameter as requiring the project name that the repository is contained in not the user name.
* Update bitbucket-pull-request.service.js
Updating the label as Bitbucket and Bitbucket Server have different parameters in the Api call. Changing to compound name per @calebcartwright recomendation.
* Update server.js
Removing code that was refactored and caught in my Pull Request
* Reversing commit back on bitbucket-pull-request.service.js to its previous state.
Co-authored-by: danielle <185722+danielle@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* Test server running with metrics enabled
* Verify custom metric was send
* Extra code removed
* Tests moved to core/server/server.spec.js
* tickAsync value based on push interval
* Trigger Build
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
There is an internal `makeBadge()` function which is called from a few places in the server and from the public `makeBadge()` function which is a light wrapper. (Eventually we want to dogfood the public API: that's the work of #4950, and this helps with it by aligning the interfaces.)
Related to that is #3370, which is about aligning the `serviceData` schema (i.e. the result of `handle()`) with the public `makeBadge()` function.
A legacy quirk of the _private_ `makeBadge()` function is accepting a `text: ['label', 'message']` array instead of separate `{ label, message }` props like the rest of the codebase. `coalesceBadge()` has to translate from `{ label, message }` to `text: ['label', message']`. This removes that bit of indirection.
It also rewrites most of the tests of `coalesceBadge()` to use `.includes()`, providing IMO a slight improvement in readability.
This is the code part of #3027, following [this article](https://www.viget.com/articles/heroku-cloudflare-the-right-way/) and using [this middleware](https://github.com/clive-io/cloudflare-middleware).
I pulled in the `addHandlerAtIndex()` function @chris48s wrote for #5574.
The middleware isn't perfect for scoutcamp, since it relies on `req.ip` which is something set by Express. However, the other solutions I found were either explicitly deprecated ([cloudflare-ip](https://www.npmjs.com/package/cloudflare-ip)) or relied on dynamically fetching the list of Cloudflare hosts ([cloudflare-ips](https://www.npmjs.com/package/cloudflare-ips)), which seems unnecessary as this list has not changed in several years.
I've left this off to start, so we can test it in production using an env var before we make it the production default.
* Migrate [Discord] implementation to use bot token
* Rework authorization field creation
* Revert "Rework authorization field creation"
This reverts commit caf65bde5d.
* Add LGTM exclusion for hardcoded credentials
* Validate input to BadgeFactory.create() (#3875)
* validate input to create()
* remove deprecated properties (#3881)
* remove BadgeFactory class (#3884)
* Template literal templates (#4459)
- Remove use of the doT template library and move to generating SVG output using javascript template literals.
- Drop SVGO and mostly manually implement the optimisations.
- Add a bunch more tests
Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
* drop raster support in package CLI (#4523)
* drop raster support in package CLI
* update docs
* rename gh-badges package to badge-maker
* rename gh-badges dir to badge-maker
* update relative imports and other refs to in parent dir
'gh-badges' --> 'badge-maker'
* update snyk service tests
This change is only tangentially related
We've used the shields repo as an example for these tests so
moving files around in our repo has a knock-on effect on them
* add missing type hints to dev style page
* write the changelog/migration guide for v3
* use extension in README CLI example
* update CLI help
whoops - missed this in #4523
* bump version
* update for self-hosting users
* README updates
* drop .format param from CLI, always output SVG
* Change text[] to label and message, Remove JSON output
- Change text[] to label and message
- Fix message only badge
- Remove JSON output format
- Update the docs
* update package-lock
* rename 'template' to 'style'
* handle invalid styles in coalesceBadge
* ensure makeBadge is passed a string for template in coalesceBadge()
issue #4925
* fix (logo/no label text/label color specified) case
issue #4926
* add example of (logo/no label text/label color specified) to style debug page
* update type defs
* padding fix for FTB style
Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
* prom-client JSON to InfluxDB line protocol converter
* Converts a metric with separate names
* prom-client JSON to InfluxDB line protocol (version 2) converter
* Server has instance id
* Read the instance id from an environment variable
* More unit tests for instance-metadata
* Log instance id
* Push influx metrics
* INSTANCE_ID with dyno metadata
* Prepare influx metrics in one place
* Influx metrics endpoint should return metrics
* More readable tests
* Env added to instance metadata
* hostname as an instance label value
* HEROKU_DYNO_ID as an instance id for heroku
* Instance env can be set by env variable
* HEROKU_APP_NAME as an instance env
* Log instance metadata as a JSON
* Typo fix
* Code refactoring in tests
* wait-for-expect dev dependency added
* Test for pushing metrics
* Test for pushing metrics
* Use basic authentication for pushing metrics
* intervalSeconds=2 for development env
* Using existing methods
* TODOs removed
* Schema for influx credentials
* Influx config removed from config files
* Require username and password when influx metrics are enabled
* Unused args removed
* pushing component should log errors
* Speed up tests
* should log error responses
* InstanceMetadata class replaces by simple object
* Influx metrics can be configuredd by env variables
* Use application label name instead of service
* Unused code removed
* Integration test for prom-client and converter
* metrics.influx.enabled configuration option added
* Improved influx configuration schema
* instanceMetadata validation
* Typo fix
* Default value for env
* metrics.infux.hostnameAsAInstanceId added
* should add hostname as an instance label when hostnameAsAInstanceId is enabled
* Default values for influx configuration
* flatMap is not available in Node.js 9.4
* Env vars removed from Procfile
* Better instance metadata values in tests
* Typo fix
* lodash.groupby added to prod dependencies
* Allow other keys in private config
* Missing test - should allow other private keys when influx metrics are enabled
* Missing test - should require private metrics config when influx configuration is enabled
* log.error instead of console.log
* metrics.influx.uri -> metrics.influx.url
* Unused arguments removed
* async removed
* promisify sendMetrics
* Allow to disable prometheus metrics
* Create test server with custom config
* 'metrics-influx' resource removed
* 'metrics-influx' resource removed
* Private config schema flattened out
* Extra code removed in Prometheus tests
* promisify moved outside of the class
* Do not throw errors from got in a specific test
* hostnameAliases added
* instanceIdFrom added
* instanceIdEnvVarName added
* envLabel added to schema
* instanceMetadata is not used by InfluxMetrics
* Instance metadata removed
* hostnameAsAnInstanceId removed
* A comment added
* waitForExpect removed
* Unused code removed