appsody / controller

Appsody controller running in the development container. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
2 stars 12 forks source link

Allow The regex matching on fullpath or the on only the filename/ (leaf directory) #38

Open kewegner opened 5 years ago

kewegner commented 5 years ago

Currently the APPSODY_REGEX only is used against the file name or leaf directory rather than the full path.

It would be desirable to give users a choice.

Other Options:

It is also possible that we could default to the full path. But we would want to make sure we don't break existing stacks.

kewegner commented 4 years ago

@neeraj-laad do you have an opinion? In looking at the current stacks REGEX settings, I think java-spring-boot2 might have an issue with changing it universally.

Given no one is currently broken, we can take our time in making a decision on this.

kewegner commented 4 years ago

If we do this, we'd need to do the following:

  1. Declare and Document a new variable for stacks to use

APPSODY_REGEX_FULL_PATH (true/false) default is false

  1. Then in the code for setting up the environment variables in main.go: appsodyRegexFullPathFlag:=false

appsodyRegexFullPath:= os.Getenv("APPSODY_REGEX_FULL_PATH") if appsodyRegexFullPath !="" { appsodyRegexFullPathFlag=strconv.ParseBool(appsodyRegexFullPath) }

  1. Then modify this line: w.AddFilterHook(watcher.RegexFilterHook(r, appsodyRegexFullPathFlag))

Note that the real work here would be testing it on the stacks. For now we stick to the default of false, but if it were decided to make the default true, it would be a lot of work to go through the 15+ stacks and test if making it full path broke anything re: the regex.

kewegner commented 4 years ago

If you want to have both full path and file only, you'd need two filter hooks, and you'd need probably multiple watchdir/regex pairs, and they would need to be ordered. So that feature would be more work.