question

Upvotes
Accepted
2 0 1 1

RFA Config file - using environment variables

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

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
25.3k 87 12 25

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
2 0 1 1

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.