Skip to content

[config] Support file glob when including config files - #827

Merged
manugarg merged 1 commit into
cloudprober:masterfrom
rhodesn:config-include-glob
Aug 22, 2024
Merged

manugarg merged 1 commit into
cloudprober:masterfrom
rhodesn:config-include-glob

Conversation

@rhodesn

@rhodesn rhodesn commented Aug 15, 2024

Copy link
Copy Markdown
Contributor

This is a potential solution for #826 to enable providing a file path glob in the include config to pick up all files in a directory.
I also toyed with the idea of allowing absolute paths in the include config as well but left it out to keep PR in sync with the issue/summary. Something along the lines of:

               var absPath string
               if filepath.IsAbs(m[1]) {
                       absPath = m[1]
               } else {
                       absPath = filepath.Join(baseDir, m[1])
               }

               files, err := filepath.Glob(absPath)

@manugarg

Copy link
Copy Markdown
Contributor

@rhodesn Thanks for the PR. Just wanted to give you a heads up that I've looked at it, but not reviewed it fully yet. I'll try to review it this week.

@manugarg manugarg added this to the v0.13.7 milestone Aug 19, 2024
@rhodesn

rhodesn commented Aug 19, 2024

Copy link
Copy Markdown
Contributor Author

If this does make it in I can send a follow up for the docs.

@manugarg manugarg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've a couple of super minor comments. Looks good otherwise.

Comment thread config/config.go Resolved
Comment thread config/config.go Resolved
Allow supplying a filepath glob pattern inside the `include` so that multiple files can be included
using a single statement. Backward compatibility of including a single file is still supported as
the glob match will just return a single file path in the slice.

The glob pattern syntax is that of `filepath.Match()`.
@rhodesn
rhodesn force-pushed the config-include-glob branch from 629f37e to 5948901 Compare August 22, 2024 08:16
@rhodesn

rhodesn commented Aug 22, 2024

Copy link
Copy Markdown
Contributor Author

Thanks @manugarg, both comments addressed.

@manugarg
manugarg merged commit 6861153 into cloudprober:master Aug 22, 2024
@manugarg manugarg changed the title Support file glob when including config files [config] Support file glob when including config files Aug 22, 2024
@rhodesn
rhodesn deleted the config-include-glob branch August 23, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants