-
Notifications
You must be signed in to change notification settings - Fork 9
Description
The current JSON format you are using has it's own limitation the biggest of them being really hard to edit it. In order to make changes inside a json object, or add new host objects, you'd have to load the whole structure into the memory and then make a simple change.
A better format would be JsonLines. To be honest, i've not really liked it but it's a definite improvement over the old structure. So, instead of having a big json array, you can have multiple new-line separated json objects in a file.
{"subdomain":"example.acme.com", "ipv4":"192.168.0.1"}
{"subdomain":"example2.acme.com", "ipv4":"192.168.0.2"}
This could also allow us to store each host's details in separate files making them greppable really easily.
Or maybe, you can use another approach where there is a hosts.json file containing a big json array listing all hosts present. Like -
cat hosts.json
[
{"host":"example.acme.com"}
]
And then for each host or IP Address present inside that hosts.json file, there can be a json file.
If anyone has ideas for any better file format specifications, i'd love to hear them.
When we were working on a project (abandoned now), we worked on a graph based format. Each detail was a node. So, the host was the root node. And it contained different nodes recursively inside it describing the node before it. I have the code example implemented, it used gob to serialize the object and then base64 encode it and then gzip compress it to save space. Play around with it here. Maybe we can use that one since it's more compact in my opinion.
Thank you.