Keys and Secrets
Last updated
Last updated
When a Task Node executes tasks, some keys and secrets are injected and made accessible to the task executable by using the process.argv()
property. These keys and secrets are command-line arguments that have been passed into the NodeJS .
These keys and secrets include:
The NodeJS child_process.fork()
method is used to spawn a new Node.js process and a object is returned.
The fork()
method accepts the following three arguments:
modulePath
— A string
for a JavaScript file to execute on the child process (required)
args
— An array
of string
to pass as the child process arguments
options
— An object
that you want to pass to the child process
The second argument passed to the fork()
method will be accepted by the child process as command-line arguments, which you can retrieve in a Koii Task using the process.argv()
property:
If you're using the k2-task-template to create a task, you should see the keys and secrets already retrieved in the init.js
file: