-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add expand_keys type support for yaml files #95
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3ae0693
added yaml support to expend_keys, #54
hexelon e9ffb76
Switch to js-yaml safeLoad from loadAll
stevenscg 6f41821
Added expand_keys tests for yaml files
stevenscg 88fa676
Update README to add YAML expansion examples
stevenscg aac0ca3
Ensure the trimmed body is used
stevenscg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,7 @@ git2consul expects to be run on the same node as a Consul agent. git2consul exp | |
}] | ||
},{ | ||
"name" : "github_data", | ||
"mode" : "expand_keys", | ||
"expand_keys" : true, | ||
"url" : "[email protected]:ryanbreen/git2consul_data.git", | ||
"branches" : [ "master" ], | ||
"hooks": [{ | ||
|
@@ -203,6 +203,30 @@ A few notes on how this behaves: | |
|
||
* Any non-JSON files, including files with the extension ".json" that contain invalid JSON, are stored in your KV as if expand_keys mode was not enabled. | ||
|
||
###### YAML | ||
|
||
Similarly to JSON, git2consul can treat YAML documents in your repo as fully formed subtrees. | ||
|
||
```yaml | ||
--- | ||
# file: example.yaml or example.yml | ||
first_level: | ||
second_level: | ||
third_level: | ||
my_key: my_value | ||
``` | ||
|
||
git2consul in expand_keys mode will generate the following KV: | ||
|
||
``` | ||
/expando_keys/example.yaml/first_level/second_level/third_level/my_key | ||
or | ||
/expando_keys/example.yml/first_level/second_level/third_level/my_key | ||
``` | ||
|
||
The value in that KV pair will be `my_value`. | ||
|
||
|
||
###### .properties | ||
|
||
Similarly to JSON, git2consul can also treat [Java .properties](http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load%28java.io.Reader%29) as a simple k/v format. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? Don't you need to assign
body = body ? body.trim() : '';
even if you don't needvar
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are correct. IIR, that was a carry-over change from the other branch. Weird though that it didn't seem to affect the tests. I'll have another look when I get in this morning.