Server.Import.WatchLocalDirectory

This is an artifact that will monitor a local path for collections, which it will then ingest.


name: Server.Import.WatchLocalDirectory
description: |
   This is an artifact that will monitor a local path for collections, 
   which it will then ingest. 

type: SERVER_EVENT

parameters:
   - name: WatchDir
     default: "/tmp/watch/*.zip"

sources:
  - query: |
        SELECT * FROM foreach(
            row={
                SELECT * FROM diff(
                    query={
                        SELECT OSPath FROM glob(globs=WatchDir)
                    }, period=3, key="OSPath"
                )
                WHERE Diff =~ "added"
            }, query={
                SELECT *, import_collection(filename=OSPath), OSPath 
                FROM scope()
            }
        )