Add Config to FlagConfig struct
This refactoring allows the Serve function to be called without requiring a YAML configuration file. As a result, the function becomes easier to use from other projects, since configuration is no longer tied to an external YAML file.
The change was proposed in PR #7255 to the CoreDNS project. To maintain backward compatibility while enabling this flexibility, I added a Config field to the FlagConfig struct. This approach preserves the existing behavior while allowing external projects to inject configuration directly.
@SuperQ Here's my proposed change to enhance FlagConfig so it can accept either a config file path or a Config object. This change maintains existing functionality, but makes the code easier to integrate from other codebases.
Let me know if this aligns with your vision for the refactor. I'm happy to adjust the implementation in any way if needed.
@SuperQ can we have some review on this? It would be good to get this one rolling
Thanks for the PR! As right now this is either config struct or file based, do we see a use case where an app wants to set certain defaults via the config struct and have the user overwrite it via the file?
I think the either config or file is fine. We don't need a combo.
@mrueg I have now added a function for validating the config. Could you please take a look and provide a review when you have a chance?
@mrueg Could we get a review on this?
@mrueg @SuperQ Please let me know if there is something I can do to move this forward :)
@mrueg @SuperQ Please review these changes or let me know who I can ping for review :)