1 /*
2  * Hunt - A high-level D Programming Language Web framework that encourages rapid development and clean, pragmatic design.
3  *
4  * Copyright (C) 2015-2019, HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 module hunt.framework.Init;
13 
14 public import hunt.framework.Version;
15 
16 import std.path : buildPath, dirName;
17 import std.file : thisExePath;
18 
19 
20 __gshared string APP_PATH;
21 __gshared string DEFAULT_CONFIG_PATH = "config/";
22 __gshared string DEFAULT_RESOURCE_PATH = "resources/";
23 __gshared string DEFAULT_TEMPLATE_PATH = "views/";
24 __gshared string DEFAULT_LANGUAGE_PATH = "translations/";
25 __gshared string DEFAULT_PUBLIC_PATH = "public/";
26 __gshared string DEFAULT_STORAGE_PATH = "storage/";
27 __gshared string DEFAULT_TEMP_PATH = "tmp/";
28 __gshared string DEFAULT_LOG_PATH = "logs/";
29 __gshared string DEFAULT_SESSION_PATH = "session/";
30 
31 
32 
33 enum string DEFAULT_APP_NAME = "HuntApp";
34 enum string DEFAULT_APP_VERSION = "1.0.0";
35 enum string DEFAULT_APP_DESCRIPTION = "An application bootstrapped by Hunt Framework";
36 enum string DEFAULT_APP_Locale = "en-US";
37 
38 enum string DEFAULT_HOST = "0.0.0.0";
39 enum ushort DEFAULT_PORT = 8080;
40 
41 enum string DEFAULT_CONFIG_LACATION = "config/";
42 enum string DEFAULT_STATIC_FILES_LACATION = "wwwroot/";
43 
44 enum string DEFAULT_RUNTIME_ENVIRONMENT = ""; // development
45 
46 enum string DEFAULT_CONFIG_FILE = "application.conf";
47 enum string DEFAULT_CONFIG_EXT = ".conf";
48 enum string DEFAULT_ROUTE_CONFIG = "routes";
49 enum string DEFAULT_RESOURCES_ROUTE_LEADER = "staticDir:";
50 
51 enum string DEFAULT_USERS_CONFIG = "users";
52 enum string DEFAULT_ROLES_CONFIG = "roles";
53 
54 // default route group name
55 enum string DEFAULT_ROUTE_GROUP = "default";
56 enum string DEFAULT_ROUTE_CONFIG_EXT = ".routes";
57 
58 
59 
60 shared static this()
61 {
62     APP_PATH = dirName(thisExePath());
63     DEFAULT_CONFIG_PATH = buildPath(APP_PATH, DEFAULT_CONFIG_LACATION);
64     DEFAULT_RESOURCE_PATH = buildPath(APP_PATH, DEFAULT_RESOURCE_PATH);
65     DEFAULT_TEMPLATE_PATH = buildPath(DEFAULT_RESOURCE_PATH, DEFAULT_TEMPLATE_PATH);
66     DEFAULT_LANGUAGE_PATH = buildPath(DEFAULT_RESOURCE_PATH, DEFAULT_LANGUAGE_PATH);
67     DEFAULT_PUBLIC_PATH = buildPath(APP_PATH, DEFAULT_PUBLIC_PATH);
68     DEFAULT_STORAGE_PATH = buildPath(APP_PATH, DEFAULT_STORAGE_PATH);
69     DEFAULT_TEMP_PATH = buildPath(DEFAULT_STORAGE_PATH, DEFAULT_TEMP_PATH);
70     DEFAULT_LOG_PATH = buildPath(DEFAULT_STORAGE_PATH, DEFAULT_LOG_PATH);
71     DEFAULT_SESSION_PATH = buildPath(DEFAULT_STORAGE_PATH, DEFAULT_SESSION_PATH);
72 }