🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

monfig

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monfig

Environment aware, asynchronous, folder based config building for node.

latest
npmnpm
Version
1.0.24
Version published
Maintainers
1
Created
Source

monfig

Environment aware, asynchronous, folder based config building for Nodejs

API

This package is basically the way Sails.js does its configuration. See their docs to get a more in depth look at how the folder structure and naming decides the config objects structure.

Sails.js Config docs

monfig.build(options):Promise<Object>

import {build} from "monfig"

build({ basePath: "./config", env: process.env.NODE_ENV })
  .then((config) => {
    // config == {
    //   "reddis": {
    //     "url": "productionurl"
    //   },
    //   "facebook": {
    //     "apikey": "prodkey"
    //   }
    // }
  })

Async config

/config/foo.js

import fetch from 'isomorphic-fetch'

export default async function factory() {
  const response = await fetch('192.168.1.13:1337/foo.json')
  // response == {
  //   "bar": "lol"
  // }
  return response.json()
}

app.js

import {build} from "monfig"

export default async function init() {
  const config = await build({ basePath: "./config", env: process.env.NODE_ENV })
  // config == {
  //   "foo": {
  //     "bar": "lol"
  //   }
  // }
}

Keywords

config

FAQs

Package last updated on 29 Apr 2016

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