2022-10-13 19:09:14 +02:00
|
|
|
/**
|
|
|
|
* Authors:
|
|
|
|
* Mike Bierlee, m.bierlee@lostmoment.com
|
2023-01-11 00:06:41 +01:00
|
|
|
* Copyright: 2022-2023 Mike Bierlee
|
2022-10-13 19:09:14 +02:00
|
|
|
* License:
|
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* The full terms of the license can be found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import mirage.ini : loadIniConfig, parseIniConfig;
|
|
|
|
|
|
|
|
import std.stdio : writeln;
|
|
|
|
import std.conv : to;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
auto config = loadIniConfig("config.ini");
|
|
|
|
auto serverConfig = config.getConfig("server");
|
|
|
|
auto databaseConfig = parseIniConfig("
|
|
|
|
host=localhost
|
|
|
|
port=5432
|
|
|
|
");
|
|
|
|
|
|
|
|
auto applicationName = config.get("application.name");
|
|
|
|
|
|
|
|
auto httpHost = serverConfig.get("host");
|
|
|
|
auto httpPort = serverConfig.get!uint("port");
|
|
|
|
auto httpProtocol = serverConfig.get("protocol");
|
|
|
|
|
|
|
|
auto dbHost = databaseConfig.get("host");
|
|
|
|
auto dbPort = databaseConfig.get!uint("port");
|
|
|
|
|
|
|
|
writeln("Starting " ~ applicationName ~ "...");
|
|
|
|
writeln("Connecting to database at " ~ dbHost ~ ":" ~ dbPort.to!string ~ "...");
|
|
|
|
writeln(
|
|
|
|
"HTTP server now listening at " ~ httpProtocol ~ "://" ~ httpHost ~ ":" ~ httpPort
|
|
|
|
.to!string);
|
|
|
|
}
|