Add ServerConfiguration schema to validate Meteor settings, removed defaultSettings, ran JSCS for DIMSEService package

This commit is contained in:
Erik Ziegler committed 2016-08-09 15:53:09 +02:00
1 parent 356abd0978
commit d4b014847a
16 files changed
+1696 -1429

No files matched your search

+160
View File
@@ -0,0 +1,160 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
export const DICOMWebRequestOptions = new SimpleSchema({
auth: {
type: String,
label: 'Username:Password Authentication String',
},
logRequests: {
type: Boolean,
defaultValue: true,
label: 'Log Requests?',
},
logResponses: {
type: Boolean,
defaultValue: false,
label: 'Log Responses?',
},
logTiming: {
type: Boolean,
defaultValue: true,
label: 'Log Timing?',
},
});
export const DICOMWebServer = new SimpleSchema({
name: {
type: String,
label: 'Name',
max: 100
},
wadoUriRoot: {
type: String,
label: 'WADO URI Root',
max: 1000
},
qidoRoot: {
type: String,
label: 'QIDO Root',
max: 1000
},
// TODO: Remove this
wadoUriRootNOTE: {
type: String,
label: 'WADO URI Root Note',
optional: true
},
wadoRoot: {
type: String,
label: 'WADO Root',
max: 1000
},
qidoSupportsIncludeField: {
type: Boolean,
label: 'QIDO Supports Include Field?',
defaultValue: false
},
imageRendering: {
type: String,
label: 'Image Rendering',
defaultValue: 'wadouri'
},
requestOptions: {
type: DICOMWebRequestOptions,
label: 'Request Options'
}
});
export const DIMSEPeer = new SimpleSchema({
host: {
type: String,
label: 'Host URL',
},
port: {
type: Number,
label: 'Port',
min: 1,
defaultValue: 11112,
max: 65535
},
aeTitle: {
type: String,
label: 'Application Entity (AE) Title',
},
default: {
type: Boolean,
label: 'Default?',
defaultValue: false
},
server: {
type: Boolean,
label: 'Server?',
defaultValue: false
},
supportsInstanceRetrievalByStudyUid: {
type: Boolean,
label: 'Supports instance retrieval by StudyUid?',
defaultValue: true
}
});
export const DIMSEServer = new SimpleSchema({
name: {
type: String,
label: 'Name',
max: 100
},
peers: {
type: [ DIMSEPeer ],
label: 'DIMSE Peers',
}
});
export const UISettings = new SimpleSchema({
studyListFunctionsEnabled: {
type: Boolean,
label: 'Study List Functions Enabled?',
defaultValue: true
}
});
export const PublicServerConfig = new SimpleSchema({
verifyEmail: {
type: Boolean,
label: 'Verify Email',
defaultValue: false
},
ui: {
type: UISettings,
label: 'UI Settings'
}
});
export const Servers = new SimpleSchema({
dicomWeb: {
type: [ DICOMWebServer ],
label: 'DICOMWeb Servers',
optional: true
},
dimse: {
type: [ DIMSEServer ],
label: 'DIMSE Servers',
optional: true
}
});
export const ServerConfiguration = new SimpleSchema({
servers: {
type: Servers,
label: 'Servers'
},
defaultServiceType: {
type: String,
label: 'Default Service Type',
defaultValue: 'dicomWeb'
},
public: {
type: PublicServerConfig,
label: 'Public Server Configuration',
}
});
+6 -5
View File
@@ -5,7 +5,7 @@ Package.describe({
});
Package.onUse(function (api) {
api.versionsFrom('1.3.5.1');
api.versionsFrom('1.4');
api.use('ecmascript');
api.use('standard-app-packages');
@@ -15,6 +15,7 @@ Package.onUse(function (api) {
api.use('practicalmeteor:loglevel');
api.use('rwatts:uuid');
api.use('silentcicero:jszip');
api.use('aldeed:simple-schema');
// Note: MomentJS appears to be required for Bootstrap3 Datepicker, but not a dependency for some reason
api.use('momentjs:moment');
@@ -37,6 +38,9 @@ Package.onUse(function (api) {
// console for debugging purposes
api.addFiles('log.js');
api.addFiles('both/collections.js', [ 'client', 'server' ]);
api.addFiles('both/schema.js', [ 'client', 'server' ]);
// Components
api.addFiles('client/components/worklist.html', 'client');
api.addFiles('client/components/worklist.js', 'client');
@@ -78,6 +82,7 @@ Package.onUse(function (api) {
// Server-side functions
api.addFiles('server/collections.js', 'server');
api.addFiles('server/validateServerConfiguration.js', 'server');
api.addFiles('server/lib/namespace.js', 'server');
api.addFiles('server/lib/encodeQueryData.js', 'server');
api.addFiles('server/methods/getStudyMetadata.js', 'server');
@@ -99,16 +104,12 @@ Package.onUse(function (api) {
api.addFiles('server/services/remote/studies.js', 'server');
api.addFiles('server/services/remote/retrieveMetadata.js', 'server');
api.addFiles('both/collections.js', [ 'client', 'server' ]);
api.export('Services', 'server');
// Export Worklist helper functions for usage in Routes
api.export('getTimepointName', 'client');
api.export('getStudyMetadata', 'client');
api.export('getStudiesMetadata', 'client');
api.export('openNewTab', 'client');
api.export('setWorklistSubscriptions', 'client');
api.export('switchToTab', 'client');
api.export('progressDialog', 'client');
api.export('Worklist');
@@ -0,0 +1,12 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { ServerConfiguration } from '../both/schema.js';
Meteor.startup(() => {
console.log('------ Testing Meteor Settings ------');
let config = ServerConfiguration.clean(Meteor.settings);
console.log(JSON.stringify(config, null, 2));
Meteor.settings = config;
check(config, ServerConfiguration);
});