npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nv-remote-cfg

v1.0.11

Published

nv-remote-cfg ============ - cli tool - create a config file server - support dynamic-modify-config through unix\_sock OR http

Downloads

6

Readme

nv-remote-cfg

  • cli tool
  • create a config file server
  • support dynamic-modify-config through unix_sock OR http

install

  • npm install nv-remote-cfg

usage

 #  npm install nv-remote-cfg -g
 
    nv_rcfg_srv -H
    Usage: nv_rcfg_srv [options]
    Options:
        -p, --port           server port or unix_sock, default ./___usock___
        -d, --workdir        work dir, default ./
        -H, --help           usage

HTTP

init

  # mkdir cfg-srv
  # cd cfg-srv/
  # nv_rcfg_srv -p 18888
    
    //...wait install node_modules

    root@dev:/home/dev/RCFG/cfg-srv# ls -l | egrep -v node_modules
    total 8
    -rw-r--r-- 1 root root   2 Feb  9 08:49 cfg
    -rw-r--r-- 1 root root 194 Feb  9 08:49 srv
     
    root@dev:/home/dev/RCFG/cfg-srv#

    root@dev:/home/dev/RCFG/cfg-srv# cat cfg
    {}
    root@dev:/home/dev/RCFG/cfg-srv#
    root@dev:/home/dev/RCFG/cfg-srv# cat srv

    const S = require("nv-remote-cfg-srv");
    const path = require("path");
    module.exports = async ()=> {
        await S(18888,path.join("/home/dev/RCFG/cfg-srv",'cfg'),"/home/dev/RCFG/cfg-srv");
        return(S)
    }

edit cfg

 <> means Map
 () means Set
 {} means Dict
 [] means Array
    support comments

 
 # vim cfg 
 /*
    {
       url: "http://api0.com"

       options-set:
          ( js,ts,json,astml )

       names: [ "bob bob", alice, jack ]

       map:
           <
              [Radio,Multi,Const]: [radio, multi, const]
              Var : var
              var : Var
           >
    }

 */ 

start srv

    > const S = await require("./srv")()
    listen on: 18888
    
    > S.CFG         //this is a getter, for dynamic-change-from-remote
    {
      url: 'http://api0.com',
      'options-set': Set(4) { 'js', 'ts', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    >

get config from remote

    root@dev:/home/dev/RCFG/cfg-srv# nv_rcfg_client -H
    Usage: nv_rcfg_client [options]
    Options:
        -h, --host          host,default 127.0.0.1, if using unix_sock: NO effect
        -a, --path          path,default /cfg, if using unix_sock: NO effect
        -p, --port          server port or unix_sock, default ./___usock___
        -S, --show          show remote config
        -m, --modify        modify cmd,such as CFG...
        -H, --help          usage

    root@dev:/home/dev/RCFG/cfg-srv#

    root@dev:/home/dev/RCFG/cfg-srv# nv_rcfg_client -S -p 18888
    {
      url: 'http://api0.com',                              
                               //we will change this
      'options-set': Set(4) { 'js', 'ts', 'json', 'astml' },              
                               //we will delete ts from options-set
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    root@dev:/home/dev/RCFG/cfg-srv#

change config from remote when server running

  • CFG is keywords

set prop

    # nv_rcfg_client -p 18888 -m "CFG.url = 'https://API18888.net'"
    before:
    {
      url: 'http://api0.com',
      'options-set': Set(4) { 'js', 'ts', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    ------------
    after:
    {
      url: 'https://API18888.net',
      'options-set': Set(4) { 'js', 'ts', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    } 

delete set-element

    # nv_rcfg_client -p 18888 -m "CFG['options-set'].delete('ts')"
    
    before:
    {
      url: 'https://API18888.net',
      'options-set': Set(4) { 'js', 'ts', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    ------------
    after:
    {
      url: 'https://API18888.net',
      'options-set': Set(3) { 'js', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }

check it on server AFTER change from client

    > S.CFG
    {
      url: 'https://API18888.net',                                                     //===============>
      'options-set': Set(3) { 'js', 'json', 'astml' },                                 //------------>
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    >

check the cfg file AFTER change from client

    root@dev:/home/dev/RCFG/cfg-srv# cat cfg
    {
            "url" :
            "https://API18888.net" ,
            "options-set" :
            (
                    "js" ,
                    "json" ,
                    "astml"
            ) ,
            "names" :
            [
                    "bob bob" ,
                    "alice" ,
                    "jack"
            ] ,
            "map" :
            <
                    [
                            "Radio" ,
                            "Multi" ,
                            "Const"
                    ] :
                    [
                            "radio" ,
                            "multi" ,
                            "const"
                    ] ,
                    "Var" :
                    "var" ,
                    "var" :
                    "Var"
            >
    }

UNIX_SOCK

  • for security

server

 # vim ./srv
 //change the port to undefined
 S(
     undefined,   //====>
     path.join("/home/dev/RCFG/cfg-srv",'cfg'),
     "/home/dev/RCFG/cfg-srv"
 );


 > const S = await require("./srv")()
 listen on: /home/dev/RCFG/cfg-srv/___usock___

client

/*
    root@dev:/home/dev/RCFG/cfg-srv# nv_rcfg_client -S
    {
      url: 'https://API18888.net',
      'options-set': Set(3) { 'js', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    root@dev:/home/dev/RCFG/cfg-srv#

    */



    # nv_rcfg_client -m "CFG.map.set('Const','const')"
    
    before:
    {
      url: 'https://API18888.net',
      'options-set': Set(3) { 'js', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(3) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var'
      }
    }
    ------------
    after:
    {
      url: 'https://API18888.net',
      'options-set': Set(3) { 'js', 'json', 'astml' },
      names: [ 'bob bob', 'alice', 'jack' ],
      map: Map(4) {
        [ 'Radio', 'Multi', 'Const' ] => [ 'radio', 'multi', 'const' ],
        'Var' => 'var',
        'var' => 'Var',
        'Const' => 'const'
      }
    }

LICENSE

  • ISC