1 /**
2 * Copyright © DiamondMVC 2018
3 * License: MIT (https://github.com/DiamondMVC/Diamond/blob/master/LICENSE)
4 * Author: Jacob Jensen (bausshf)
5 */
6 module diamond.core.apptype;
7 
8 public
9 {
10   version (Diamond_WebServer)
11   {
12     /// Boolean determining whether the application is compiled as a webserver or not.
13     static const bool isWebServer = true;
14     /// Boolean determining whether the application is compiled as a webapi or not.
15     static const bool isWebApi = false;
16   }
17   else version (Diamond_WebApi)
18   {
19     /// Boolean determining whether the application is compiled as a webserver or not.
20     static const bool isWebServer = false;
21     /// Boolean determining whether the application is compiled as a webapi or not.
22     static const bool isWebApi = true;
23   }
24   else
25   {
26     /// Boolean determining whether the application is compiled as a webserver or not.
27     static const bool isWebServer = false;
28     /// Boolean determining whether the application is compiled as a webapi or not.
29     static const bool isWebApi = false;
30   }
31 
32   /// Boolean determining whether the application is web related or not.
33   static const bool isWeb = isWebServer || isWebApi;
34 
35   version (Diamond_UnitTesting)
36   {
37     /// Boolean determining whether the application is running tests or not.
38     static const bool isTesting = isWeb; // Testing can only be enabled for web applications.
39   }
40   else
41   {
42     /// Boolean determining whether the application is running tests or not.
43     static const bool isTesting = false;
44   }
45 
46   version (Diamond_Logging)
47   {
48     /// Boolean determining whether the application logs or not.
49     static const bool loggingEnabled = isWeb; // Testing can only be enabled for web applications.
50   }
51   else
52   {
53     /// Boolean determining whether the application logs or not.
54     static const bool loggingEnabled = false;
55   }
56 }