Open prologic opened 5 years ago
If a path is specified, file extensions are used to determine the format. If reading from stdin, you need to specify the format.
This way you can simply point consulator at a file/directory, or, you can just pipe to it directly from a git archive
or curl ..
or whatever.
So to be clear; the following are exactly equivalent:
$ cat foo.yaml | consulator import -yaml
and:
$ consulator import foo.yaml
?
As well as for example:
$ mkdir -p foo
$ cat > foo/foo.yaml <<EOF
foo: bar
EOH
$ consulator import ./foo/
Mostly :)
When you specify a directory rather than a specific file, the relative paths of files within it are used as part of the resulting key names.
For example, given a directory structure like this:
./abc/def/xyz.yaml
with xyz.yaml containing foo: bar
consulator import ./
would result in a key path of "abc/def/xyz/foo: bar
consulator import ./abc
would result in a key path of "def/xyz/foo: bar
For your examples, the first two would have a key path of just foo: bar
whereas the last one would end up as foo/foo: bar
due to the foo.yaml filename.
consulator dump
is useful for testing things like this without polluting or needing to run consul.
Got it! Thanks!
On Mon, 1 Jul 2019 at 16:28, Lewis Peckover notifications@github.com wrote:
Mostly :)
When you specify a directory rather than a specific file, the relative paths of files within it are used as part of the resulting key names.
For example, given a directory structure like this: ./abc/def/xyz.yaml with xyz.yaml containing foo: bar
consulator import ./ would result in a key path of "abc/def/xyz/foo: bar consulator import ./abc would result in a key path of "def/xyz/foo: bar
For your examples, the first two would have a key path of just foo: bar whereas the last one would end up as foo/foo: bar due to the foo.yaml filename.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lewispeckover/consulator/issues/10?email_source=notifications&email_token=AAJ276T5U7YDE24SC6JKN2TP5GPYNA5CNFSM4H4OMHM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY5DY2Q#issuecomment-507133034, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJ276X2RB3Y6FNHXGKGFB3P5GPYNANCNFSM4H4OMHMQ .
--
James Mills / prologic
E: prologic@shortcircuit.net.au W: prologic.shortcircuit.net.au
I'm a little confused of the option
path
that can be supplied toconsulator import ...
as well as (by the looks) justconsulator
too (_judging from the--help
).Can you explain how
path
is used when many of the-yaml
,-json
, etc options ofconsulator import
clearly state they read the data from STDIN.I look at the code a bit but didn't understand what was happening with
c.flags.Args()
.