RFA Config file - using environment variables

naresh.patel
naresh.patel Newcomer

Hi

I’ve developed some code
based on RFA example StarterConsumer_Batchview and I need to set the hostname
using an environment variable. Does the Config file support something like this
:

\Connections\Connection_RSSL\hostName
= ${REUTERS_HOST}

Thanks

Tagged:

Best Answer

  • umer.nalla
    umer.nalla LSEG
    Answer ✓

    Hi @naresh.patel

    I am not aware of a way of using Environmental variables within a .cfg file.

    However, RFA does allow you to modify the StagingConfigDatabase after you load / populate it from a file.

    You should then be able to add a entry to the StagingConfigDatabase with the value read from your environmental variable (e.g. read programmatically or passed in on the command line?).

    result = _pStgCfgDataBase->load(flatFile, exampleRfaCfgFilePath);

    if(result)
    pStgCfgDatabase->setString("\\Connections\\Connection_RSSL\\serverList", "myserver1 myserver2");

    result = _pCfgDataBase->merge(*_pStgCfgDataBase);

    In the above example after the flatfile has been loaded, I am adding a serverList parameter to the connection - with two servers myserver1 and myserver2

    You should really be using a serverList rather than hostName - to allow the API to attempt failover in case one server is not available / cannot connect / loses connection. Please read the RFA ConfigGuide description for serverList for more details.

    NOTE: You can add entries to the Staging Config Database - you cannot override existing - so ensure you don't include the severList (or any other) parameter in the .cfg if you plan to add it as above.

Answers

  • Thank you for your reply Umer. That really helped and thanks for the server list tip too.