aboutsummaryrefslogtreecommitdiff
path: root/src/serverConfig.ts
diff options
context:
space:
mode:
authorcjd242018-02-06 21:20:00 +0000
committercjd242018-02-06 21:20:00 +0000
commit84ef4db188b1988227feba832e5779587de42a48 (patch)
tree47302c5f9cd8da71cbcdb817e3490ab88f856ae2 /src/serverConfig.ts
parentMerge branch 'trh/node-tidy' into 'master' (diff)
downloadmedicine-84ef4db188b1988227feba832e5779587de42a48.tar.gz
medicine-84ef4db188b1988227feba832e5779587de42a48.zip

Filled in some of the first method stubs, added serverconfig.ts, and added script to install postgres on lab machine for doing db stuff

Diffstat (limited to 'src/serverConfig.ts')
-rw-r--r--src/serverConfig.ts52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/serverConfig.ts b/src/serverConfig.ts
new file mode 100644
index 0000000..b10641a
--- /dev/null
+++ b/src/serverConfig.ts
@@ -0,0 +1,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,
+}