aboutsummaryrefslogtreecommitdiffstats
path: root/server/commands/admin/saveconfig.js
blob: ed3a312548e814b7cb7ed6acb4119ab5eb92d2b7 (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
34
35
36
/*
  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',
  description: 'Saves current config'
};