Incoming data needs to be transformed into key value pairs:
SECRET_TOKEN=Iwillruletheworld;SECRET_REFRESH_TOKEN=Iwillruletheworld;SERVER_PORT=3000;SERVER_WS_PORT=4000;NODE_URI=http://test.abc.com/#/;MONGODB_DEFAULT_URI=mongodb;MONGODB_HOST=localhost;MONGODB_PORT=27017;
To start, separate the data using ;
:
data.split(';');
Current Output
[ 'SECRET_TOKEN=Iwillruletheworld',
'SECRET_REFRESH_TOKEN=Iwillruletheworld',
'SERVER_PORT=3000',
'SERVER_WS_PORT=4000',
'NODE_URI=http://test.abc.com/#/',
'MONGODB_DEFAULT_URI=mongodb',
'MONGODB_HOST=localhost',
'MONGODB_PORT=27017'
]
The goal now is to convert it into key value pairs:
Expected Output
[ 'SECRET_TOKEN'='Iwillruletheworld',
'SECRET_REFRESH_TOKEN'='Iwillruletheworld',
'SERVER_PORT'='3000',
'SERVER_WS_PORT'='4000',
'NODE_URI'='http://test.abc.com/#/',
'MONGODB_DEFAULT_URI'='mongodb',
'MONGODB_HOST'='localhost',
'MONGODB_PORT'='27017'
]
A task remains - inserting '
wherever =
appears. Assistance would be appreciated.