I have a low latency app in Node.js from which I am coding a new baseline in Go.
The app in node uses config and some key/value pairs.
In config/index.js
var config = {};
config.app = {
port:9000
};
config.log= {
level:"error"
}
module.exports=config;
And another file config/key_values.js which contains key/value pair and is refreshed every few minutes.
module.exports.key_values= {
"key1":"value1",
"key2":"value2",
}
And to read this I just use the below code.
let config = require('./config/index');
let keys_vals = require('./config/key_values.js');
console.log('port', config.app.port); //port 9000
console.log('key1 data -->', keys_vals.key_values['key1']); //key1 data --> value1
How can I achieve the same thing in go. I have checked Gonfig for config implementation as well as building structs.
What should be better/best way to achieve the same functionalities as I do in Node?