New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aofl/server-environment

Package Overview
Dependencies
Maintainers
2
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/server-environment

Helps determine dev, stage, prod environments based on hostname

3.0.0-beta.17
Source
npm
Version published
Weekly downloads
76
280%
Maintainers
2
Weekly downloads
 
Created
Source

@aofl/server-environment

Helps determine dev, stage, prod environments based on hostname.

Examples

  • https://stackblitz.com/edit/1-0-0-server-environment?embed=1

Installation

npm i -S @aofl/server-environment

Usage

import {getServerEnvironment, environmentTypeEnumerate} from '@aofl/server-environment';

const env = getServerEnvironment(/localhost/, /^stage\./);
const debugMode = (env === environmentTypeEnumerate.DEV);

Methods

getServerEnvironment

Takes a devRegex and a stageRegex and tests them against hostname. Returns 'production' if the regexes do not capture any results from hostname.

NameTypeDescription
devRegexRegExp
stageRegexRegEx

Constants

environmentTypeEnumerate

KeyValue
DEVdevelopment
STAGEstage
PRODproduction

Keywords

aofljs

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts