mattolenik / cloudflare-ddns-client

A robust dynamic DNS client for CloudFlare, geared towards home lab usage. Written in Go.
The Unlicense
6 stars 2 forks source link

Config not found in /etc #13

Open timkgh opened 2 years ago

timkgh commented 2 years ago

The help says:

--config string Path to config file. If not specified will look for cloudflare-ddns.toml in the program dir (), $HOME/.config, or /etc, in that order

But running it without --config it does not find the file in /etc/cloudflare-ddns.toml even though it exists and it's readable. Invoking with an explicit --config /etc/cloudflare-ddns.toml works.

timkgh commented 2 years ago

Running an strace, it seems there's an extra .toml in the extension. Of course, if I name the file /etc/cloudflare-ddns.toml.toml it finds it.

newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.json", 0xc000091a38, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.toml", 0xc000091b08, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.yaml", 0xc000091bd8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.yml", 0xc000091ca8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.properties", 0xc000091d78, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.props", 0xc000091e48, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.prop", 0xc000091f18, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.hcl", 0xc000132038, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.tfvars", 0xc000132108, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.dotenv", 0xc0001321d8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.env", 0xc0001322a8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/bin/cloudflare-ddns.toml.ini", 0xc000132378, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.json", 0xc000132448, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.toml", 0xc000132518, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.yaml", 0xc0001325e8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.yml", 0xc0001326b8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.properties", 0xc000132788, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.props", 0xc000132858, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.prop", 0xc000132928, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.hcl", 0xc0001329f8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.tfvars", 0xc000132ac8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.dotenv", 0xc000132b98, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.env", 0xc000132c68, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/.config/cloudflare-ddns.toml.ini", 0xc000132d38, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.json", 0xc000132e08, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.toml", 0xc000132ed8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.yaml", 0xc000132fa8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.yml", 0xc000133078, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.properties", 0xc000133148, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.props", 0xc000133218, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.prop", 0xc0001332e8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.hcl", 0xc0001333b8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.tfvars", 0xc000133488, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.dotenv", 0xc000133558, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.env", 0xc000133628, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/etc/cloudflare-ddns.toml.ini", 0xc0001336f8, 0) = -1 ENOENT (No such file or directory)
d4z3x commented 1 year ago

I fixed this in my fork, and sent a PR here. My fork is here: https://github.com/d4z3x/cloudflare-ddns-client