You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parse-conf.js 877B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. var hconfig = require("hconfig");
  2. module.exports = parse;
  3. var configStructure = {
  4. display: {
  5. count: "many",
  6. props: {
  7. name: "string",
  8. mode: "string",
  9. rate: "string",
  10. where: "object",
  11. },
  12. },
  13. input: {
  14. count: "many",
  15. props: {
  16. name: "string",
  17. type: "string",
  18. commands: "array",
  19. options: "array",
  20. },
  21. },
  22. wallpaper: {
  23. count: "once",
  24. props: {
  25. name: "null",
  26. path: "string",
  27. },
  28. },
  29. process: {
  30. count: "many",
  31. props: {
  32. name: "string",
  33. run: "array",
  34. "in": [ "string", "null" ],
  35. env: [ "object", "null" ],
  36. restart: "bool",
  37. as: [ "string", "null" ],
  38. delay: [ "number", "null" ],
  39. },
  40. },
  41. }
  42. function parse(file) {
  43. try {
  44. return hconfig.parseConfFile(
  45. file, configStructure);
  46. } catch (err) {
  47. if (err.hconfigParseError) {
  48. console.error(err.message);
  49. process.exit(1);
  50. } else {
  51. throw err;
  52. }
  53. }
  54. }