Keys and Secrets
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 Child process.
These keys and secrets include:
How Does This Work?
The NodeJS child_process.fork()
method is used to spawn a new Node.js process and a ChildProcess
object is returned.
The fork()
method accepts the following three arguments:
modulePath
— Astring
for a JavaScript file to execute on the child process (required)args
— Anarray
ofstring
to pass as the child process argumentsoptions
— Anobject
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:
Last updated