TimothyYe / godns

A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
https://timothyye.github.io/godns/
Apache License 2.0
1.52k stars 224 forks source link

yaml config file support in docker? #199

Closed kngharv closed 1 year ago

kngharv commented 1 year ago

Is config in yaml format supported in the docker image?

The reason I am asking this is that

godns -c ~/config.yaml

everything is fine.

When I switched to docker image, pass the config file in the "docker run" command with "-v /home/user/docker/godns/config.yaml:/config.yaml"

I go the error in the log:

Error occurs while reading config file, please make sure config file exists! time="2023-00-00T00:00:00Z" level=fatal msg="open ./config.json: no such file or directory"

Does it mean that for docker image, only json config format is supported?

Thanks in advance

TimothyYe commented 1 year ago

Oh, this might be an issue, I'll check it.

TimothyYe commented 1 year ago

@kngharv The release v2.9.8 fixes this problem: https://github.com/TimothyYe/godns/releases/tag/v2.9.8

While running GoDNS with a YAML config file, an extra environment is needed, for example:

docker run \
-d --name godns \
-e CONFIG=/config.yaml \
--restart=always \
-v /path/to/config.yaml:/config.yaml \
timothyye/godns:latest

The environment CONFIG is the path of the config.yaml which is mounted into the docker container.