config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const CONFIG = require('craftlabhttpserver/src/config.js');
  2. const FILENAME = process.mainModule.path + "/config.json";
  3. const fs = require('fs');
  4. const path = require('path');
  5. let configEntries = CONFIG;
  6. (() => {
  7. CONFIG.Initialize({
  8. port: { value: 80, valid: CONFIG.validNumber },
  9. instanceHostname: { value: require('os').hostname(), valid: CONFIG.validNotEmptyString },
  10. ldapUrl: { value: "", valid: CONFIG.validNotEmptyString },
  11. ldapBindDN: { value: "", valid: CONFIG.validNotEmptyString },
  12. ldapBindPwd: { value: "", valid: CONFIG.validNotEmptyString },
  13. ldapBase: { value: "", valid: CONFIG.validNotEmptyString },
  14. database: { value: "", valid: CONFIG.validNotEmptyString }
  15. });
  16. configEntries.photoLibraries = [];
  17. let hasErrors = false;
  18. for (let i of CONFIG.getInitialContent().photoLibraries)
  19. if (CONFIG.validNotEmptyString(i))
  20. configEntries.photoLibraries.push(i);
  21. configEntries.ldapFilters = [];
  22. console.log(configEntries);
  23. if (hasErrors)
  24. throw "Errors found while parsing configuration";
  25. })();
  26. module.exports = configEntries;