"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:

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

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

Read More...