Reading a file to use in a node's config dialog?

I'm looking at upgrading the node-red-contrib-interactive-ssh node. I'd like to add the ability to allow picking a host configuration from the ~/.ssh/config file. The config dialog runs in a browser, so obviously doesn't have access (and shouldn't) to the host's file system.
How would I go about to provide a local function I could call to return some values read from a file on the host to use in the node's configuration file?

1 Like

To answer my own question...
I added to the JS file interactive-ssh.js

RED.nodes.registerType('interactive-ssh', InteractiveSSH, {
    settings: {
      interactiveSshHosts: {
        value: extractHosts(),
        exportable: true

with extractHosts a function on top of the file:

onst fs = require('fs');
const SSHConfig = require('ssh-config');

const getStringFromFile = (source) => {
  const data = fs.readFileSync(source, {
    encoding: 'utf8',
    flag: 'r'
  return data;

const extractHosts = () => {
  let fileName = process.env.HOME + '/.ssh/config';
  let cfgJson = getStringFromFile(fileName);
  let cfg = SSHConfig.parse(cfgJson);
  let result = [];
  for (let entry of cfg) {
    if (entry.param == 'Host') {
  return result;