Skip to content

WATCHED_EXTs input format needs upgrading #7

@matthewbloch

Description

@matthewbloch

Currently you specify which files to send by specifying space-separated extensions in the WATCHED_EXTS variable, e.g. for Golang we'd use WATCHED_EXTS="go mod".

The matching code, after splitting on spaces, is strings.HasSuffix(path, "."+ext), i.e. it will match man.go but not mango.

We have a problem that we want to match files that have no extension e.g. Dockerfile, so this syntax needs changing to support it.

I could simply remove the "." from the check, but that leaves it open to uploading files it shouldn't when there's a typo e.g. if you entered a single character that would catch a lot of files by accident. But we still want to be able to use the exercise environment for common files that have a single letter extension e.g. .c or .h for the C language.

I'm going to update it to work (temporarily) two ways:

  • if there's no . found in WATCHER_EXTS, it keeps to the current 👆🏻 behaviour
  • if there's a . found in WATCHER_EXTS, it does not add the . to any extensions, assumes you are specifying them

This should allow us to push changes to the various docker-compose.yml files that use it, and then I can kick away the old parsing in the next release. Will document this properly in both phases; it should only be a few weeks of transition.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions