Configuration file is now read in from arguments.
This commit is contained in:
parent
0d6b757923
commit
5204274a76
22
source/app.d
22
source/app.d
|
@ -8,6 +8,7 @@ import std.stdio : File, writeln;
|
||||||
import std.json : parseJSON, JSONValue;
|
import std.json : parseJSON, JSONValue;
|
||||||
import listeners.listener;
|
import listeners.listener;
|
||||||
import listeners.types;
|
import listeners.types;
|
||||||
|
import std.file : exists;
|
||||||
|
|
||||||
unittest d
|
unittest d
|
||||||
{
|
{
|
||||||
|
@ -15,15 +16,26 @@ unittest d
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main(string[] args)
|
||||||
{
|
{
|
||||||
|
/* Make sure we have atleast two arguments */
|
||||||
|
if(args.length >= 2)
|
||||||
|
{
|
||||||
|
/* Get the second argument for configuration file path */
|
||||||
|
string configFilePath = args[1];
|
||||||
|
|
||||||
/* TODO: Change this */
|
/* Start thhe server if the file exists, else show an error */
|
||||||
string address = "0.0.0.0";
|
if(exists(configFilePath))
|
||||||
ushort port = 2222;
|
{
|
||||||
|
startServer(args[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writeln("Provided server configuration file \"" ~ configFilePath ~ "\" does not exist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: Add usage check and arguments before this */
|
/* TODO: Add usage check and arguments before this */
|
||||||
startServer("server.conf");
|
|
||||||
|
|
||||||
dprint("Main finished, remaining threads are keeping this open if it hangs");
|
dprint("Main finished, remaining threads are keeping this open if it hangs");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue