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

@arcjet/env

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcjet/env

Arcjet environment detection

  • 1.0.0-alpha.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
decreased by-17.95%
Maintainers
2
Weekly downloads
 
Created
Source
Arcjet Logo

@arcjet/env

npm badge

Arcjet environment detection.

Currently operates on an environment object with the type:

type Env = {
  FLY_APP_NAME?: string;
  NODE_ENV?: string;
  ARCJET_KEY?: string;
  ARCJET_ENV?: string;
  ARCJET_LOG_LEVEL?: string;
  ARCJET_BASE_URL?: string;
};

Installation

npm install -S @arcjet/env

Example

import * as env from "@arcjet/env";

env.platform({ FLY_APP_NAME: "foobar" }) === "fly-io";
env.platform({}) === undefined;

env.isProduction({ NODE_ENV: "production" }) === true;
env.isProduction({ NODE_ENV: "development" }) === false;
env.isProduction({ ARCJET_ENV: "production" }) === true;
env.isProduction({ ARCJET_ENV: "development" }) === false;

env.isDevelopment({ NODE_ENV: "production" }) === false;
env.isDevelopment({ NODE_ENV: "development" }) === true;
env.isDevelopment({ ARCJET_ENV: "production" }) === false;
env.isDevelopment({ ARCJET_ENV: "development" }) === true;

env.logLevel({ ARCJET_LOG_LEVEL: "debug" }) === "debug";
env.logLevel({ ARCJET_LOG_LEVEL: "info" }) === "info";
env.logLevel({ ARCJET_LOG_LEVEL: "warn" }) === "warn";
env.logLevel({ ARCJET_LOG_LEVEL: "error" }) === "error";
env.logLevel({ ARCJET_LOG_LEVEL: "" }) === "warn"; // default

// Will use various environment variables to detect the proper base URL
env.baseUrl(process.env);

env.apiKey({ ARCJET_KEY: "ajkey_abc123" }) === "ajkey_abc123";
env.apiKey({ ARCJET_KEY: "invalid" }) === undefined;

License

Licensed under the Apache License, Version 2.0.

FAQs

Package last updated on 17 Jun 2024

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

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