Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dotcom-reliability-kit/app-info

Package Overview
Dependencies
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotcom-reliability-kit/app-info - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

27

lib/index.js

@@ -46,5 +46,22 @@ const path = require('path');

/**
* Extract the proceess type from a Heroku dyno name.
*
* @param {string} dyno
* The dyno name to normalize.
* @returns {string}
* Returns the process type of a dyno, e.g. `web` for a dyno called `web.1`.
*/
function normalizeHerokuProcessType(dyno) {
return dyno.split('.')[0];
}
const systemCode =
process.env.SYSTEM_CODE || getSystemCodeFromPackage(process.cwd()) || null;
const processType =
process.env.AWS_LAMBDA_FUNCTION_NAME ||
(process.env.DYNO && normalizeHerokuProcessType(process.env.DYNO)) ||
null;
module.exports = {

@@ -104,3 +121,11 @@ /**

*/
systemCode
systemCode,
/**
* The dyno process type.
*
* @readonly
* @type {string | null}
*/
processType
};

@@ -107,0 +132,0 @@

2

package.json
{
"name": "@dotcom-reliability-kit/app-info",
"version": "1.1.0",
"version": "1.2.0",
"description": "A utility to get application info in a consistent way.",

@@ -5,0 +5,0 @@ "repository": {

@@ -13,2 +13,3 @@

* [`appInfo.systemCode`](#appinfosystemcode)
* [`appInfo.processType`](#appinfoprocesstype)
* [Contributing](#contributing)

@@ -70,3 +71,12 @@ * [License](#license)

### `appInfo.processType`
Get the type of the running process, which is the name for the current process within an application.
For AWS Lambda, this is the name of the function, read from `process.env.AWS_LAMBDA_FUNCTION_NAME`.
For Heroku, this is derived from the first part of `process.env.DYNO`, which is set to by Heroku, e.g. a dyno called `web.1` will have `processType` set to `web`. The process types in an application are defined by the application's `Procfile`.
If neither `process.env.AWS_LAMBDA_FUNCTION_NAME` or `process.env.DYNO` are set, this property will be `null`
## Contributing

@@ -73,0 +83,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc