import handy_http_transport; import slf4d; import slf4d.default_provider; import api_mapping; import util.config; import scheduled_jobs; /** * Starts the Finnow API. */ void main() { // testUDA(); const config = readConfig(); configureSlf4d(config); startScheduledJobs(); startWebServer(config); } void configureSlf4d(in AppConfig config) { Level logLevel = getConfiguredLoggingLevel(config); auto provider = new DefaultProvider(logLevel); configureLoggingProvider(provider); } void startWebServer(in AppConfig config) { Http1TransportConfig transportConfig = defaultConfig(); transportConfig.port = config.port; HttpTransport transport = new TaskPoolHttp1Transport(mapApiHandlers(config.webOrigin), transportConfig); transport.start(); } // void testUDA() { // import std.traits : getSymbolsByUDA; // import std.stdio; // static assert(getSymbolsByUDA!(app, Attr).length == 2); // Attr a; // static foreach(symbol; getSymbolsByUDA!(app, Attr)) { // pragma(msg, symbol); // pragma(msg, __traits(identifier, symbol)); // pragma(msg, "------------------"); // static foreach(attr; __traits(getAttributes, symbol)) { // pragma(msg, "Attribute:"); // pragma(msg, attr); // pragma(msg, __traits(identifier, attr)); // static if (is(typeof(attr) == Attr)) { // pragma(msg, "Found target attribute!"); // pragma(msg, attr.val); // a = attr; // writefln!"Function %s has attr val = %d"((__traits(identifier, symbol)), a.val); // } else { // pragma(msg, "Other attribute :("); // } // } // } // } // struct Attr { // int val; // } // enum OtherAttr; // @Attr(5) @OtherAttr // void testMethod1() { // int x = 5; // } // @Attr(42) // void testMethod2() { // int y = 5; // }