aboutsummaryrefslogtreecommitdiff
path: root/src/serverConfig.ts
blob: 0403b052ff0f0319964a05180da5183d6beb7903 (plain) (blame)
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
const serverConfig: Property[] = [];

/* This is a class used to define the optional attribute of Property,
	 if the property is user configurable*/
export class PropertyDisplay {
	public category: string;
	public group: string;
	public displayName: string;
	public description: string;

	public constructor(cat: string, grp: string, dn: string, desc: string) {
		this.category = cat;
		this.group = grp;
		this.displayName = dn;
		this.description = desc;
	}
}

/* This is a class used to contain all of the protocol attributes of a Property
	 of the current backend server.*/
export interface Property {
	id: string;
	display?: PropertyDisplay;
	readOnly: boolean;
	type: string;
	value: string | number | boolean;
}

// Logging
let propertyDisplay: PropertyDisplay = new PropertyDisplay(
	'Logging',
	'BE4',
	'Is logging enabled?',
	'This property defines if logging is currently enabled on this backend server.'
);

serverConfig.push({
	id: 'Server_Log',
	display: propertyDisplay,
	readOnly: false,
	type: 'boolean',
	value: false
});

// Caching Settings (global)
serverConfig.push({
	id: 'Global_Cache_Limit',
	readOnly: true,
	type: 'integer',
	value: 1
});

// Caching Settings (project level)
propertyDisplay = new PropertyDisplay(
	'Caching',
	'BE4',
	'Caching Type',
	'This property defines the current caching style for this project.'
);

serverConfig.push({
	id: 'project_example',
	display: propertyDisplay,
	readOnly: false,
	type: 'integer',
	value: 1
});

export const propertyExists: (propKey: string) => number =
	(propKey: string): number => {
	let found: number = -1;
	for (const prop in serverConfig) {
		if (serverConfig[prop].id === propKey) {
			found = parseInt(prop, 10);
			break;
		}
	}
	return found;
};

export default serverConfig;