All files / src/commands/ng ng.get-config.command.js

76.19% Statements 16/21
100% Branches 1/1
0% Functions 0/1
76.19% Lines 16/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x           193x 193x  
import { defineCommand } from '../../lib/define-command.js';
import { Logger } from '../../logger.js';
import * as networkGroup from '../../models/ng.js';
import { orgaIdOrNameOption } from '../global.options.js';
import { ngExternalIdOrLabelArg, ngIdOrLabelArg } from './ng.args.js';
 
export const ngGetConfigCommand = defineCommand({
  description: 'Get the WireGuard configuration of a peer in a Network Group',
  since: '3.12.0',
  options: {
    org: orgaIdOrNameOption,
  },
  args: [ngExternalIdOrLabelArg, ngIdOrLabelArg],
  async handler(options, peerIdOrLabel, ngIdOrLabel) {
    const { org } = options;

    const peerConfig = await networkGroup.getPeerConfig(peerIdOrLabel, ngIdOrLabel, org);

    Logger.println(peerConfig);
  },
});