@porosys/pss
Version:
Porosys Server Setup (pss): General-purpose server setup and automation tool (including Netdata management)
42 lines (33 loc) • 1.13 kB
text/typescript
import { input, select } from '@inquirer/prompts';
import chalk from 'chalk';
import { loadConfig, saveConfig } from '../config/config.helper';
import { NetdataConfig } from '../config/config.type';
export const netdataConfigCommand = async () => {
const currentConfig = await loadConfig();
if (!currentConfig) {
console.log(
chalk.yellow('⚠️ No config found. Run `pss install` first.'),
);
return;
}
console.log(chalk.green.bold('\n⚙️ Current pss Configuration\n'));
console.log(currentConfig);
const port = await input({
message: 'Netdata Web UI Port:',
default: currentConfig.port,
});
const restartPolicy = await select({
message: 'Restart Netdata after config changes?',
choices: [
{ name: 'Always', value: 'always' },
{ name: 'Ask me every time', value: 'ask' },
{ name: 'Never', value: 'never' },
],
default: currentConfig.restartPolicy,
});
const answers = { port, restartPolicy };
await saveConfig(answers as NetdataConfig);
console.log(
chalk.green('\n✅ Configuration updated and saved to ~/.netdatarc'),
);
};