nginx-conf icon indicating copy to clipboard operation
nginx-conf copied to clipboard

_remove/update on a block not working.

Open parthmehta opened this issue 9 years ago • 1 comments

Hi,

Config example :

rtmp{
  server{

    application A{
      live on;
      #..othercommands
    }

    application B{
      live on;
      #..othercommands
    }

    application C{
      live on;
      #..othercommands
    }

  }
}

Have added application blocks using _addVerbatimBlock function. Currently, there is no update function. So, for updating, I remove the block and add it again. But the following remove functions does not work :

 conf.nginx.rtmp.server._remove("application A")
 conf.nginx.rtmp.server._remove("application A",0)
 conf.nginx.rtmp.server._remove("application", "A")

Which is the correct way to remove or update the block ?

  • Cant use index of application ( application[1] ) to remove.

parthmehta avatar Sep 19 '16 09:09 parthmehta

Removed by looping over application array. I think we should have a function for the same. Will send a PR.

for(let i =0;i<conf.nginx.rtmp.server.application.length ; i++){
           let a = conf.nginx.rtmp.server.application[i]
           console.log(a._value,i)
           if(a._value.toString() == "B")){
                console.log("REMOVING",a._value)
                 conf.nginx.rtmp.server._remove("application",i)
           }
        }

parthmehta avatar Sep 19 '16 11:09 parthmehta