Hi I found out we can add Expressions to Credentials just like any other node but its always empty so is there a way I can point the expression to a workflow so I can pull API keys from Bitwarden or HTTP Request, maybe a file.
Cheers
Hi I found out we can add Expressions to Credentials just like any other node but its always empty so is there a way I can point the expression to a workflow so I can pull API keys from Bitwarden or HTTP Request, maybe a file.
Cheers
Hi I found out we can add Expressions to Credentials just like any other node but it’s always empty so
Does the node have any input? Can you share the expression you are using?
there a way I can point the expression to a workflow so I can pull API keys from Bitwarden or HTTP Request, maybe a file.
You can point the expression to the input data of the node where you are using the expression. So, you can make an HTTP that returns the credentials and reference them in the next node.
Hi @RicardoE105
I have pasted some screenshots
So in here is the Cortex API where you can specify the instance URL , Key using Expression from the Gear button
However when I click on it it doesn’t show any node or variable like any other add expression during the workflow
so this is what I was asking how can I fill out any Credentials using Expressions.
Cheers
Do you have any other nodes in the workflow? The expression editor only shows nodes in the current workflow.
So you’d either want to pull the credentials by adding nodes to do so before the current node, or pass the credentials in using a webhook trigger.
There is a file which I read using SSH
The file contain some passwords and API key I still need to clean it a bit using functions but still nothing is showing on the credentials expression
In the SSH node, is the file showing up as “binary data”? If yes, here’s the general flow:
Let us know how you get on!
hi @maxT
Its not binary file its config.ini file so I extract API key from it using function and should feed it to Cortex. I will try the workflow that you created above and keep you posted.
Cheers
@MXA_Music in the case of an .ini file, the “Move binary data” node method won’t work. So if you’ve already got a function node extracting the API key, I recommend simply appending the API key to the JSON output payload of the function node: items[0].json.apiKey = {api key here};
Thank you so much it worked so now i can read the file and update the API key and localhost from the file
Once again thank you so much
That’s great to hear @MXA_Music - is there any chance you could post the code you used inside the FunctionItem node to help others in future?
Absolutely its simple code
var key = []
get_all_keys = item.stdout.split("[keys]")[1]
get_hive_key = get_all_keys.split("hiveKey = ")[1]
key.push({
hiveKey : get_hive_key
});
return key
Treating the Conf.ini file as string and the output will look like this
[
[
{
"hiveKey": "B6G1R7IBOJo0RIksEMzts2pGzSV6YCW4"
}
]
]
and to read it from other nodes its
{{$node["FunctionItem"].json["0"]["hiveKey"]}}
Save this expression in the API Key samy thing can work for the URL as well
The Sample Conf.ini is below
; Section: sectionone
[sectionone]
domains = localhost
username = admin
password = admin
[keys]
hiveKey = B6G1R7IBOJo0RIksEMzts2pGzSV6YCW4
This just dummy data for testing