system.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const _ = require('lodash')
  2. const os = require('os')
  3. const filesize = require('filesize')
  4. /* global WIKI */
  5. module.exports = {
  6. Query: {
  7. async system() { return {} }
  8. },
  9. Mutation: {
  10. async system() { return {} }
  11. },
  12. SystemQuery: {
  13. async info(obj, args, context, info) {
  14. return {
  15. currentVersion: WIKI.version,
  16. latestVersion: WIKI.version, // TODO
  17. latestVersionReleaseDate: new Date(), // TODO
  18. operatingSystem: `${os.type()} (${os.platform()}) ${os.release()} ${os.arch()}`,
  19. hostname: os.hostname(),
  20. cpuCores: os.cpus().length,
  21. ramTotal: filesize(os.totalmem()),
  22. workingDirectory: process.cwd(),
  23. nodeVersion: process.version.substr(1),
  24. redisVersion: WIKI.redis.serverInfo.redis_version,
  25. redisUsedRAM: WIKI.redis.serverInfo.used_memory_human,
  26. redisTotalRAM: _.get(WIKI.redis.serverInfo, 'total_system_memory_human', 'N/A'),
  27. redisHost: WIKI.redis.options.host,
  28. postgreVersion: WIKI.db.inst.options.databaseVersion,
  29. postgreHost: WIKI.db.inst.options.host
  30. }
  31. }
  32. },
  33. SystemMutation: { }
  34. }