forked from TFNS/CTFNote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.ts
40 lines (30 loc) · 1.19 KB
/
globals.ts
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
import PersistentConfiguration from "./persitent";
import Rights from "./rights";
export default class Globals {
static port = 31337;
static version = "v1.0.0";
static appName = "ctfnote-api";
static env = process.env.NODE_ENV || "dev";
static usernameMinLength = 1;
static usernameMaxLength = 32;
static defaultCookieExpirationTime = 10; // in days
static cookieName = "ctfnote-auth";
static userAgent = "CTFNote";
static adminRights = [Rights.ADMIN_ALL];
static defaultRights = [];
static allowRegistration = true;
static mdCreateUrl = process.env.MD_CREATE_URL || "http://front/pad/new";
static mdShowUrl = process.env.MD_SHOW_URL || "/pad";
static maxCtfPerPage = 20;
static updatableFields = {
ctf: ["ctfUrl", "start", "finish", "logo", "ctfTimeUrl", "format", "url", "description"],
};
static async init() {
Globals.mdCreateUrl = await PersistentConfiguration.setIfNotSet("md-create-url", Globals.mdCreateUrl);
Globals.mdShowUrl = await PersistentConfiguration.setIfNotSet("md-show-url", Globals.mdShowUrl);
Globals.allowRegistration = await PersistentConfiguration.setIfNotSet(
"allow-registration",
Globals.allowRegistration
);
}
}