-
Notifications
You must be signed in to change notification settings - Fork 310
Description
Checks
- I have searched the existing issues
- I have read the documentation
- Is it your first time sumbitting an issue
Current Behavior
When using an absolute path in the include directive, the included file is silently ignored without any error or warning message.
For example, with this configuration:
include {
'/etc/dae/sub.dae'
}
The file sub.dae is not loaded, but dae produces no error of it, but errors about missing definitions in the included file.
Expected Behavior
Abosulte paths in include should work correctly, or at least show a clear warning in docs like "absolute paths not supported in include directive".
I expected the fix because I am configuring my NixOS and encrypting subscription information, which is not appropriate to use relative path for the main config. (Probably I am doing in the wrong way.)
Steps to Reproduce
- Create a main config file
config.dae:include { '/etc/dae/sub.dae' } global { tproxy_port: 12345 } - Create a sub config file
sub.dae:group { mygroup { # some proxies } } - Set proper permissions and then validate or run.
- Observe that
mygroupis not loaded.
Environment
- Dae version (use
dae --version): unstable-20251103.r826.7e67e31 - OS (e.g
cat /etc/os-release): Ubuntu 24.04.3 LTS - Kernel (e.g.
uname -a): 6.6.87.2-microsoft-standard-WSL2 - Others: NA
Note that the problem is found during my NisOS configuration, so probably it's not a WSL problem.
Anything else?
In config_merger.go the dfsMerge function processes include paths like this:
case *config_parser.Param:
nextEntry := v.String(true, false)
patterEntries = append(patterEntries, filepath.Join(m.entryDir, nextEntry))for an absolute path /etc/dae/sub.dae, it will just result in /etc/dae/etc/dae/sub.dae. And after that, the filepath.Glob(pattern) will not throw any errors or warnings. So just consider check if the path is absolute before joining.