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

koatty_config

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koatty_config

Configuration loader for Koatty.

  • 1.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-66.67%
Maintainers
0
Weekly downloads
 
Created
Source

koatty_config

Configuration loader for Koatty

Usage

运行环境配置

koatty_config 可以自动识别当前运行环境,并且根据运行环境自动加载相应配置(如果存在):

const env = process.env.KOATTY_ENV || process.env.NODE_ENV || "";

如果 env = production, koatty_config 会自动加载以 _pro.ts_production.ts 后缀的配置文件。

例如:

// 自动加载 config_dev.ts 或 config_development.ts
NODE_ENV=dev ts-node "test/test.ts" 

命令行参数

koatty_config 可以自动识别命令行参数,并且自动填充到相应的配置项:

// 自动填充config.cc.dd.ee的值
NODE_ENV=dev ts-node "test/test.ts" --config.cc.dd.ee=77

占位符变量替换

koatty_config 可以自动将配置文件中使用 ${} 占位符标识的配置项替换为process.env内的同名项的值:

config.ts

export default {
    ...
    ff: "${ff_value}"
    ...
}
// 自动填充ff的值
NODE_ENV=dev ff_value=999 ts-node "test/test.ts"

FAQs

Package last updated on 06 Nov 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