Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should allow config override the object within an array #239

Closed
hoatle opened this issue Feb 6, 2017 · 0 comments
Closed

should allow config override the object within an array #239

hoatle opened this issue Feb 6, 2017 · 0 comments

Comments

@hoatle
Copy link
Member

hoatle commented Feb 6, 2017

For example default config:

    "synced_folders":[
      {
        "_id": "0",
        "type": "virtual_box",
        "host": ".",
        "guest": "/vagrant",
        "disabled": true
      },
      {
        "_id": "1",
        "type":"rsync",
        "host":"./workspace",
        "guest":"/home/vagrant/workspace",
        "rsync__exclude": [
          ".git", ".idea/", "node_modules/", "bower_components/", ".npm/"
        ]
      },
      {
        "_id":"2",
        "type":"virtual_box",
        "host":"./home/.docker",
        "guest":"/home/vagrant/.docker",
        "mount_options":[
          "dmode=775",
          "fmode=755"
        ]
      }
    ]

"_id" is required for every object within the array.

By introducing "_id" and "_op" meta key, we can override the configuration by its "_id" with its "_op" option ("a" - append, "o" - override, "r" - replace, "d" - delete).

_id exist => _op="o" by default. _op could be one of [o, r, d]
_id does not exist => _op="a" by default and only this value can be used.

_op="a": adding to the end of the array by default. To specify the index to append after, use "_idx" key with the right index (see Array.insert(index, value) Ruby API to use the right index value)

We also support force override the array key with: "r" ("r" - replace) to completely replace the array key, this is useful when we want to replace the array completely

for example:

"_r_synced_folders": []

This will replace default "synced_folders" with an empty array "[]".

"_" is reserved for teracy-dev to override the default config.

This is applied for objects within array only, for JSON object, just use its key to override.

@hoatle hoatle self-assigned this Feb 6, 2017
@hoatle hoatle modified the milestones: v0.5.0-b1, v0.5.0 Feb 6, 2017
@hoatle hoatle modified the milestones: v0.6.0, v0.5.0-b1 Feb 7, 2017
hoatle added a commit to hoatle/teracy-dev that referenced this issue Feb 7, 2017
@hoatle hoatle modified the milestones: v0.5.0-b1, v0.6.0 Feb 7, 2017
hoatle added a commit to hoatle/teracy-dev that referenced this issue Feb 8, 2017
@ghost ghost added the stag:in-progress label Feb 8, 2017
hoatle added a commit to hoatle/teracy-dev that referenced this issue Feb 8, 2017
hoatle added a commit to hoatle/teracy-dev that referenced this issue Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant