Skip to content

Support for wildcard file filter #81

@johno1985

Description

@johno1985

Version 2.5.0

For our different environments in our deployment pipeline, our audit4j config file will have an environment name infix in the filename, e.g. 'audit4j.conf-qa.yml'

We then set the path using:

System.setProperty("audit4j.conf.file.path", System.getProperty("user.home") + File.separator + "audit4j-conf*.yml");

But this results in the following exception:

java.nio.file.InvalidPathException: Illegal char <*> at index 30: C:\Users\Jonathan\audit4j-conf*.yml

Could you use the following instead?

FileFilter fileFilter = new WildcardFileFilter(filename);
File[] files = dir.listFiles(fileFilter);
int count = files.length;
if (count != 1) {
	//file not found handling goes here
}

//file found handling goes here```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions