"Life is all about sharing. If we are good at something, pass it on." - Mary Berry

Do not use jq when working with large number

2021-09-07

We use etcd to store application configuration. On production, config is loaded from json file by using Python.

I’m wondering if we can use jq to do that. So, I tried something like this:

host=${ETCD_HOST:-127.0.0.1}
port=${ETCD_PORT:-2379}
for key in $(jq -r 'keys[]' "$1"); do
  value=$(jq -r ".$key" -c "$1")
  ETCDCTL_API=3 etcdctl --endpoints="$host:$port" put "$key" "$value"
done

Config is loaded into etcd but some values are not the same as in the JSON file. What is going on?

Read More...