Closed drewgingerich closed 2 years ago
So for option 3, it also only supports one provider and one domain?
The current solution for the docker container is that you can mount a config file out of the container, there is no need to create a new image with the config file. I'm not sure if this can meet your requirement.
docker run \
-d --name godns --restart=always \
-v /path/to/config.json:/config.json \
timothyye/godns:latest
So for option 3, it also only supports one provider and one domain?
Yes, but for more complex configurations the user can mount their own config as they do now. The way Docker works, the user-provided config file will shadow the default config file, adding up to keeping the same user experience that exists right now, plus a small convenience bonus for people that only need to update one domain.
I see, if we choose option 3, does that mean the GoDNS program inside the container should read all the environment variables and compile the config template file into a real config file at the runtime?
The current solution for the docker container is that you can mount a config file out of the container, there is no need to create a new image with the config file. I'm not sure if this can meet your requirement.
docker run \ -d --name godns --restart=always \ -v /path/to/config.json:/config.json \ timothyye/godns:latest
Ah sorry, I should have provided more detail. I interact with my server remotely from my laptop by using a Docker context. This lets me work on my Docker Compose configuration on my laptop, and then push the changes to my server using normal Docker commands.
While this is convenient in most ways, a weakness is that any files a Docker container mounts still have to exist on the server. So to mount a GoDNS config file I have to copy it from my laptop to the server, or I have to make a custom image that contains the config file to carry it over for me.
I see, if we choose option 3, does that mean the GoDNS program inside the container should read all the environment variables and compile the config template file into a real config file at the runtime?
Yes exactly, and that's where solution 3 would be a change to how things are.
Alternatively we could avoid touching GoDNS at all and just use envsubst
to populate a default config shell template (rather than a Go template). I can make this version and you can see how you like the end result before considering whether GoDNS should do its own templating.
Oops I didn't realize the current image doesn't have a shell, so envsubst
is not easily available. Adding envsubst
feels pretty hacky, so I don't want to do that.
I partially raised this issue just to talk it through with you. Now that I've gotten to think about it more I'm feeling like this doesn't make sense to do right now since it adds complexity without much value. If there's a different use for a CLI or config file templating in the future then I'll bring this back up, but for now I'll close this issue. Plenty of other stuff to work on :)
I'm interested in being able to configure my Docker-deployed instance of GoDNS with just environment variables. This way I don't have to create a new image containing my config file. I can think of three ways to do this:
Of these, I like option 3 the most. Option 1 is cool, but is also complicated. Option 2 feels like it could become a dead-end. Option 3 extends what already exists.
I'm interested to know your thoughts, does this sound like a good direction and solution? If this does sound good then I'll plan to get started sometime soon.