A small 'live' web site which uses rest-api to represent a pseudo-termial-like interface.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

25 行
603B

  1. const path = require('path');
  2. const fs = require('fs');
  3. const YAML = require('yaml');
  4. var CONFIG = null;
  5. var CONFIG_PATH = "";
  6. exports = {
  7. get: function(){
  8. if (arguments.length === 1 && typeof(arguments[0]) === 'string'){
  9. if (CONFIG_PATH !== arguments[0]){
  10. var cpath = path.normalize(arguments[0]);
  11. if (!path.isAbsolute(cpath))
  12. cpath = path.join(__dirname, cpath);
  13. try {
  14. CONFIG = YAML.parse(fs.readFileSync(cpath, 'utf8'));
  15. } catch (e) {
  16. console.log("ERROR: " + e.toString());
  17. }
  18. }
  19. }
  20. return CONFIG;
  21. }
  22. };