aboutsummaryrefslogtreecommitdiff
path: root/src/serverConfig.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/serverConfig.ts')
-rw-r--r--src/serverConfig.ts119
1 files changed, 74 insertions, 45 deletions
diff --git a/src/serverConfig.ts b/src/serverConfig.ts
index b10641a..0403b05 100644
--- a/src/serverConfig.ts
+++ b/src/serverConfig.ts
@@ -1,52 +1,81 @@
-var serverConfig : Property[] = [];
+const 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;
-};
+ if the property is user configurable*/
+export class PropertyDisplay {
+ public category: string;
+ public group: string;
+ public displayName: string;
+ public 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;
+ public constructor(cat: string, grp: string, dn: string, desc: string) {
+ this.category = cat;
+ this.group = grp;
+ this.displayName = dn;
+ this.description = desc;
+ }
}
-//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;
+/* 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;
}
-module.exports = {
- default : serverConfig,
- propertyExists : propertyExists,
-}
+// 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;