-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
112 lines (97 loc) · 2.3 KB
/
config.ts
File metadata and controls
112 lines (97 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
class configd
{
__base = __dirname + "/";
__views = __dirname + "/";
env = process.env.NODE_ENV || "dev";
httpPort = process.env.HTTP_PORT || 666;
httpsPort = process.env.HTTPS_PORT || 443;
database: Database =
{
host: "mongodb://localhost:27017/",
schema: "blog",
user: process.env.DB_USER || "root",
password: process.env.DB_PASSWORD || "root"
};
cache: Cache =
{
path: __dirname + "/cache"
};
log: Log =
{
path: __dirname + "/logs",
access: __dirname + "/logs/access-log.txt",
error: __dirname + "/logs/error-log.txt",
level: 6,
print: true,
write: true
};
security: Security =
{
rechaptasecret: process.env.RECAPTCHASECRET || "6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe"
};
web: Web =
{
publicDirectories: [
{ route: "/web", "redirect": __dirname + "/wwwroot" },
{ route: "/wwwroot", "redirect": __dirname + "/wwwroot" },
{ route: "/cache", "redirect": this.cache.path }
]
};
cert: Cert =
{
server_key: process.env.CERT_SERVER_KEY || __dirname + "/../test/cert/server-key.pem",
server_crt: process.env.CERT_SERVER_CRT || __dirname + "/../test/cert/server-crt.pem",
ca_crt: process.env.CERT_CA_CRT || __dirname + "/../test/cert/ca-crt.pem"
};
test: any;
}
interface Database
{
host: string;
schema: string;
user: string;
password: string;
}
interface Cache
{
path: string;
}
interface Log
{
path: string;
access: string;
error: string;
level: number; //log.levels.ALL
print: boolean;
write: boolean;
}
interface Security
{
rechaptasecret: string;
}
interface Cert
{
server_key: string;
server_crt: string;
ca_crt: string;
}
interface Web
{
publicDirectories: any;
}
const config = new configd();
//Test
if (process.env.NODE_ENV == "test")
{
config.cache.path = "C:\\Users\\kasper.kiiskinen\\NodeBlog\\";
config.__base = "C:\\Users\\kasper.kiiskinen\\NodeBlog\\";
config.__views = "C:\\Users\\kasper.kiiskinen\\NodeBlog\\";
config.database =
{
host: "mongodb://localhost:27017/",
schema: "blogTestdb",
user: "root",
password: "root"
}
};
export = config;