Yaml 格式配置全局载入库 confyaml

码农软件 · 软件分类 · 常用JavaScript包 · 2019-04-04 19:28:32

软件介绍

Yaml格式配置全局载入库,将单个或者多个yaml格式的配置文件映射到系统环境变量中。只需在入口文件中包含confyaml包,就可以在同一项目不同文件中获取配置项,无需多次导入读取yaml文件。

安装

通过npm或者yarn下载

~ npm i --save[-dev] confyaml
# or 
~ yarn add [--dev] confyaml

使用

config.yaml

app_name: here is app name

tips: config.yaml 文件如果在项目的根目录,那么在入口文件导入如下代码即可。

require("confyaml").config()

app.js

// in app.js
require("confyaml").config(); // *default read root directory config.yaml*
// or
require("confyaml").config({path: "./config.yaml"})
// or
require("confyaml").config({
    path: [
        "./config.yaml",
        "./database.yaml"
    ]
})
 
// in other files.
console.log(process.env.get("app"))
// -> here is app name

本文地址:https://codercto.com/soft/d/2865.html

Data-intensive Text Processing With Mapreduce

Data-intensive Text Processing With Mapreduce

Jimmy Lin、Chris Dyer / Morgan and Claypool Publishers / 2010-4-30 / USD 40.00

Our world is being revolutionized by data-driven methods: access to large amounts of data has generated new insights and opened exciting new opportunities in commerce, science, and computing applicati......一起来看看 《Data-intensive Text Processing With Mapreduce》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具