aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/admin/saveconfig.js
blob: 116abd66fa2d678020b2ecbea94d6a1640622f10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
  Description: Writes any changes to the config to the disk
*/

exports.run = async (core, server, socket, data) => {
  if (socket.uType != 'admin') {
    // ignore if not admin
    return;
  }

  let saveResult = core.managers.config.save();

  if (!saveResult) {
    server.reply({
      cmd: 'warn',
      text: 'Failed to save config, check logs.'
    }, client);

    return;
  }

  server.reply({
    cmd: 'info',
    text: 'Config saved!'
  }, socket);

  server.broadcast({
    cmd: 'info',
    text: 'Config saved!'
  }, { uType: 'mod' });
};

exports.info = { name: 'saveconfig' };