aboutsummaryrefslogtreecommitdiff
path: root/src/serverConfig.ts
blob: b10641a03a8c1cce1a5ddfbbb37837ba4cf7718b (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
var serverConfig : Property[] = [];

/* This is a class used to define the optional attribute of Property,
   if the property is user configurable*/
class PropertyDisplay {
    constructor(cat : string, grp : string, dn : string, desc : string) {
      this.category = cat;
      this.group = grp;
      this.display_name = dn;
      this.description = desc;
    };
    category : string;
    group : string;
    display_name : string;
    description : string;
};

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

//Logging
var property_display = 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 : property_display, read_only : false, type : "boolean", value : false});

//caching settings (global)
serverConfig.push({id : "Global_Cache_Limit", read_only : true, type : "integer", value : 1});
//caching settings (project level)
property_display = new PropertyDisplay("Caching", "BE4", "Caching Type", "This property defines the current caching style for this project.");
serverConfig.push({id : "project_example", display : property_display, read_only : false, type : "integer", value : 1});

function propertyExists (propKey : string): number {
    var found = -1;
    for (var prop in serverConfig) {
        if (serverConfig[prop].id == propKey) {
            found = parseInt(prop);
            break;
        }
    }
    return found;
}

module.exports = {
    default : serverConfig,
    propertyExists : propertyExists,
}