config-manager.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const fs = require('fs');
  2. const path = require('path');
  3. const configFilePath = path.join(__dirname, 'oasis-config.json');
  4. if (!fs.existsSync(configFilePath)) {
  5. const defaultConfig = {
  6. "themes": {
  7. "current": "Dark-SNH"
  8. },
  9. "modules": {
  10. "popularMod": "on",
  11. "topicsMod": "on",
  12. "summariesMod": "on",
  13. "latestMod": "on",
  14. "threadsMod": "on",
  15. "multiverseMod": "on",
  16. "invitesMod": "on",
  17. "walletMod": "on",
  18. "legacyMod": "on",
  19. "cipherMod": "on",
  20. "bookmarksMod": "on",
  21. "videosMod": "on",
  22. "docsMod": "on",
  23. "audiosMod": "on",
  24. "tagsMod": "on",
  25. "imagesMod": "on",
  26. "trendingMod": "on",
  27. "eventsMod": "on",
  28. "tasksMod": "on",
  29. "marketMod": "on",
  30. "tribesMod": "on",
  31. "governanceMod": "on",
  32. "reportsMod": "on",
  33. "opinionsMod": "on",
  34. "transfersMod": "on",
  35. "feedMod": "on",
  36. "pixeliaMod": "on",
  37. "agendaMod": "on",
  38. "aiMod": "on"
  39. },
  40. "wallet": {
  41. "url": "http://localhost:7474",
  42. "user": "ecoinrpc",
  43. "pass": "",
  44. "fee": "1"
  45. }
  46. };
  47. fs.writeFileSync(configFilePath, JSON.stringify(defaultConfig, null, 2));
  48. }
  49. const getConfig = () => {
  50. const configData = fs.readFileSync(configFilePath);
  51. return JSON.parse(configData);
  52. };
  53. const saveConfig = (newConfig) => {
  54. fs.writeFileSync(configFilePath, JSON.stringify(newConfig, null, 2));
  55. };
  56. module.exports = {
  57. getConfig,
  58. saveConfig,
  59. };