-
Notifications
You must be signed in to change notification settings - Fork 4
Antfarm
Samuel Munroe edited this page Oct 26, 2016
·
9 revisions
The Antfarm object is the factory that creates all of the basic components.
var Antfarm = require('antfarm');
var af = new Antfarm();
var folder = af.createFolderNest("/var/my/folder");
var tunnel = af.createTunnel("My workflow");
When instantiating Antfarm, you may pass it an antfarm options object.
var Antfarm = require('antfarm'),
af = new Antfarm({
log_out_level: "warning"
});
###Example
Configuring your email credentials
var Antfarm = require('antfarm'),
af = new Antfarm({
log_out_level: "warning"
email_credentials: {
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: "[email protected]",
pass: "emailpassword123",
}
}
});
You can put your workflows in separate node modules in another directory and have Antfarm load them all.
// Import Antfarm
var Antfarm = require('antfarm'),
af = new Antfarm({});
// Load your workflow directory
af.loadDir("./workflows");
Your workflow files should export a function that takes an Antfarm object in its constructor, like so:
// ./workflows/workflow_a.js
var WorkflowA = function(antfarm){
var wf = this;
wf.af = antfarm;
wf.tunnel = wf.af.createTunnel("Workflow A");
// etc...
};
module.exports = WorkflowA;