nconf icon indicating copy to clipboard operation
nconf copied to clipboard

Add ref value support

Open asnir opened this issue 11 years ago • 3 comments

Is there any way that I can use reference value? In order to reduce the number of lines at the config file. At the example bellow, I would like to create a new entry named: common which will contain the db section.

{
  "serviceX": {
    "param1": "val1",
    "param2": "val2",
    "db": {
      "connection": {
        "host": "",
        "port": "",
        "schema": "",
        "username": "",
        "password": ""
      }
    },
    "param3": "val3",
    "param42": "val4",
    "param5": "val5"
  },
    "serviceY": {
    "param1": "val89",
    "param2": "val23",
    "db": {
      "connection": {
        "host": "",
        "port": "",
        "schema": "",
        "username": "",
        "password": ""
      }
    },
    "param32": "val2",
    "param42": "val43"
  }
}

asnir avatar Nov 19 '14 10:11 asnir

@asnir not sure I understand you.

indexzero avatar Nov 26 '14 05:11 indexzero

The result will be something like that:

{
  "serviceX": {
    "param1": "val1",
    "param2": "val2",
    "db": {
      "@ref": "common.db"
    },
    "param3": "val3",
    "param42": "val4",
    "param5": "val5"
  },
  "serviceY": {
    "param1": "val89",
    "param2": "val23",
    "db": {
      "@ref": "common.db"
    },
    "param32": "val2",
    "param42": "val43"
  },
  "common": {
    "db": {
      "connection": {
        "host": "",
        "port": "",
        "schema": "",
        "username": "",
        "password": ""
      }
    }
  }
}

asnir avatar Nov 30 '14 13:11 asnir

No, but a PR would be welcome for this.

indexzero avatar Sep 20 '15 08:09 indexzero