Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Make ignoring of file watching event actions configurable #39

Open

Description

@kewegner

In an earlier issue it was found it might be useful to ignore one of the six types of events, specifically DIR WRITE.

We could create additional APPSODY environment variables which allow our users to turn off any of the six actions for either FILES, DIRs or both

The six actions supported by the watcher include:

CREATE
WRITE
RENAME
MOVE
REMOVE
CHMOD

Activity

  1. changed the title [-]Make ignoring of file watching event types configurable[/-] [+]Make ignoring of file watching event actions configurable[/+] on Sep 20, 2019
  2. kewegner commented on Dec 3, 2019

    @kewegner
    CollaboratorAuthor

    These comments assume that directory events would be re-enabled. If not there is no need for the directory piece of this work.

    First it must be noted no one has asked for this feature as of yet.

    To approach the problem the following would need to be done.

    Declare either a single variable or multiple variables in the Dockerfile-stack on two axis:
    e.g.
    APPSODY_FILE_CONTROLLER_ACTIONS=chmod,write,create,remove,rename, move
    APPSODY_DIRECTORY_CONTROLLER_ACTIONS=chmod,write,create,remove,rename, move

    -- we may need NONE as an option, and if both are none we might not want to enable the watcher.

    The default would be that all actions are allowed for both if no variables are present,

    The controller would then need to read in these environment variables.

    The watcher could have a map for directory actions allowed and a map for file actions allowed.

    The pollEvents loop would need to basically check:

    1. Is the current item a file or a directory.
    2. what is the action being performed and is it allowed for this type (file/directory).

    The filter might need to be different in the sense that the action would need to be known, whereas today only the regex or type (file/directory) would need to be known.

    If directory events are not needed, or the events are deemed to be the same for file and directory we could also investigate using the filterOps method on the watcher.

    // FilterOps filters which event op types should be returned
    // when an event occurs.
    func (w *Watcher) FilterOps(ops ...Op) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions