March 05, 2017
I had seen some mentions about `vibe.conf` file in vibed docs. But can't understand it's structure and find examples of it's usage.


March 05, 2017
On Sunday, 5 March 2017 at 13:41:23 UTC, Suliman wrote:
> I had seen some mentions about `vibe.conf` file in vibed docs. But can't understand it's structure and find examples of it's usage.

Json file. Real example:
```
{
	"mqttHost"       : "***.***.**.***",
	"mqttPort"       : 1883,
	"mqttClientName" : "*****",
	"mqttUsername"   : "*****",
	"mqttPassword"   : "*****",
	
	"listenInterface": "127.0.0.1",
	"listenPort"     : 8088,
	
	"dbConnection"   : "host=127.0.0.1;user=root;pwd=;db=dbname"
}
```

You can read values from it like this:

```
// Read http setting from vibe.conf and init session store
HTTPServerSettings prepareHttpSettings()
{
	auto settings = new HTTPServerSettings;
	settings.port = readRequiredOption!ushort("listenPort","Port to listen by internal HTTP server");
	settings.bindAddresses = [readRequiredOption!string("listenInterface", "Interface to listen by internal HTTP server")];
	settings.sessionStore = new MemorySessionStore;
	
	return settings;
}
```