cli.config.js

1.3.0 • Public • Published

cli.config

config for cli

tips

  • cli.config support hot load config per 5 min

how to use in code

npm i --save cli.config.js

recommand use

var cc = require('cli.config.js')
var yourDefaultConfig = {
     example1 : "LiSA",
     example2 : {
         name : "LiSA",
         remark: "hello good day"
     }
}
var cc = require('cli.config.js').system('yourProgramName')
    .default(yourDefaultConfig)
    .force(yourConfirmedConfig)

// here get config
console.log(cc.get('example1'))
// LiSA
console.log(cc.get().example1)
// LiSA
console.log(cc.get().example2.name)
// LiSA
console.log(cc.get('example2.name'))
// LiSA

// here set config
cc.set({
    "newName" : 123,
    "lover" : {
        name : "LiSA",
        age : 32
    }
}) 
// it will restore @ your system user

cc.clear()
//clean configs 

cc.set("key","value")
// add node key
console.log(cc.get("key"))

how to use in cli

npm i -g cli.config.js
cconfig -h
cc -h

using in prod env

pliz set env :

vim /etc/profile

export CC_PATH="/cli.config/"

Readme

Keywords

Package Sidebar

Install

npm i cli.config.js

Weekly Downloads

1

Version

1.3.0

License

MIT

Unpacked Size

13.9 kB

Total Files

9

Last publish

Collaborators

  • apporoad