mirror of
https://github.com/mbierlee/mirage-config.git
synced 2025-02-23 03:02:41 +01:00

Some checks failed
CI / dmd-2.097.2 on ubuntu-latest (push) Failing after 3s
CI / dmd-2.098.1 on ubuntu-latest (push) Failing after 3s
CI / dmd-2.099.1 on ubuntu-latest (push) Failing after 3s
CI / dmd-2.100.2 on ubuntu-latest (push) Failing after 3s
CI / dmd-2.101.2 on ubuntu-latest (push) Failing after 3s
CI / dmd-2.102.2 on ubuntu-latest (push) Failing after 3s
CI / dmd-latest on ubuntu-latest (push) Failing after 3s
CI / ldc-1.27.1 on ubuntu-latest (push) Failing after 3s
CI / ldc-1.28.1 on ubuntu-latest (push) Failing after 3s
CI / ldc-1.29.0 on ubuntu-latest (push) Failing after 3s
CI / ldc-1.30.0 on ubuntu-latest (push) Failing after 3s
CI / ldc-1.31.0 on ubuntu-latest (push) Failing after 3s
CI / ldc-1.32.0 on ubuntu-latest (push) Failing after 3s
CI / ldc-latest on ubuntu-latest (push) Failing after 3s
CI / dmd-latest on macos-latest (push) Has been cancelled
CI / dmd-latest on windows-latest (push) Has been cancelled
CI / ldc-latest on macos-latest (push) Has been cancelled
CI / ldc-latest on windows-latest (push) Has been cancelled
37 lines
1.1 KiB
D
37 lines
1.1 KiB
D
/**
|
|
* Authors:
|
|
* Mike Bierlee, m.bierlee@lostmoment.com
|
|
* Copyright: 2022-2025 Mike Bierlee
|
|
* 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.java : parseJavaProperties, loadJavaProperties;
|
|
|
|
import std.stdio : writeln;
|
|
import std.conv : to;
|
|
|
|
void main() {
|
|
auto config = loadJavaProperties("application.properties");
|
|
auto serverConfig = config.getConfig("server");
|
|
auto databaseConfig = parseJavaProperties("
|
|
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);
|
|
}
|