lewispeckover / consulator

Import and synchronize your Consul KV data from JSON and YAML
MIT License
32 stars 13 forks source link

format error #6

Closed vTNT closed 6 years ago

vTNT commented 6 years ago

my yaml file:

docker:
    - image: ubuntu:14.04
    - image: mongo:2.6.8
      command: [mongod, --smallfiles]
    - image: postgres:9.4.1

i run this command:

consulator import -glue=, /usr/local/ns-configs/dev/

but the result is Error: Invalid type map[string]interface {} in array. Only strings, numbers and boolean values are supported. did it support this format?

vTNT commented 6 years ago
redis:
  - host: 1
  - k: 2

did it support this format?

vTNT commented 6 years ago

i found that this format is fine:

redis:
  host: 1
  password: 2
  port: 3
lewispeckover commented 6 years ago

No, as Consul is a simple key/value store - how would you expect your earlier examples to be represented in Consul?

linydquantil commented 6 years ago

ok, did you store redis/mysql configuration in consul? I'm currently trying to put redis/mysql configuration in Consul;

lewispeckover commented 6 years ago

You can put any config you like in there, so long as it can be represented as keys with values - and internally Consul only supports string values. This works:

foo:
  abc: 1
  def: x

This works:

foo:
  bar:
    abc: 1
    def: y
  xyz:
    abc: 1
    def: z

This also works:

foo:
  bar: 1
  servers:
    - server1
    - server2
    - server3

In this special case the "servers:" array will be joined into a string within consul (default glue=\n) , so you'd need to split it when you read the value back out.

linydquantil commented 6 years ago

got it, i will try it again, thank you ^ ^