ddns-updater
ddns-updater copied to clipboard
FEATURE REQUEST: add config.json blank template in the image
Another idea for simpler setup:
When /updater/data/config.json is not found, copy a default template config.json stored in the image to /updater/data/config.json
Thanks for the suggestion!
Although I'm planning on having a web UI to input records (so no more dealing with the json file) so the user would just have to create a data directory (or use a future built-in docker anonymous volume, so no need to any setup). I'll try to finish this up this weekend/next week. Otherwise I'll do that feature request you suggest!
touch data/config.json 👎 make default config.json available 👍 web UI for setup 👍 👍 👍 👍 👍 👍
as a side note, if a webui is built to configure the records, I would advocate keeping the possibility to configure the records through json and env variables as it is today. Indeed, I believe people who use dynamic dns updater(s) are more likely to prefer configuration files and command lines over web UI. IMO a web UI that displays information is super cool, but a UI that allows me to update the configuration is a plus I would fancy but don't really need. Indeed I rely heavily on Configuration As Code for my homelab setup (everything is automated with ansible + docker swarm). I bet a lot of users are in a similar case, am I right?
Otherwise, regarding the original idea of this feature request, it looks good to me ^^. Let's note it will change the actual behavior of ddns-updater. Today if the config is not found, the program starts and throws an error and exit.
If there is a web ui, we would still need state so keeping the JSON file as is (maybe add some other fields on top of settings
) is the goal here 😉 But thanks for the input!
For the empty file, we can just create an empty json file if it doesn't exist at start. I don't think anyone cares if the program doesn't crash if the file is not found retro-compatibility wise 😄
{"settings": []}
But note I'm still at 0% on that, I would first need to set up an http API server to fiddle with its state. And this is blocked by a bunch of things in my head 🤯 😄
To accommodate a future-to-be UI, the program was changed as follows:
- If the config file does not exist, it is created with content
{}
. Note that the directory containing it is not created, so it will fail in this case if the directory doesn't exist for example. - If
CONFIG
has some valid value, it is written to the file as indented JSON (as of 1e74dc6179f12bbaeaace0acbea4342d4fcea60e) - The program runs even if you have no settings (designed as such to add things through the UI).
- The
CONFIG
value still takes precedence over the file. This is problematic if we have the UI since this one would modify the file, but notCONFIG
. I'm thinking of swapping the precedence around, any suggestion?
Thanks! I'll close the issue soon.