def edit_config(cluster_name: str, group: Optional[int], force: bool, quiet: bool, kvpairs: List[str],
                pgkvpairs: List[str], apply_filename: Optional[str], replace_filename: Optional[str]) -> None:
    """Process ``edit-config`` command of ``patronictl`` utility.

    Update or replace Patroni configuration in the DCS.

    :param cluster_name: name of the Patroni cluster.
    :param group: filter which Citus group configuration we should edit. Refer to the module note for more details.
    :param force: if ``True`` apply config changes without asking for confirmations.
    :param quiet: if ``True`` skip showing config diff in the console.
    :param kvpairs: list of key value general parameters to be changed.
    :param pgkvpairs: list of key value Postgres parameters to be changed.
    :param apply_filename: name of the file which contains with new configuration parameters to be applied. Pass ``-``
        for using stdin instead.
    :param replace_filename: name of the file which contains the new configuration parameters to replace the existing
        configuration. Pass ``-`` for using stdin instead.

    :raises:
        :class:`PatroniCtlException`: if
            * Configuration is absent from DCS; or
            * Detected a concurrent modification of the configuration in the DCS.
    """
    dcs = get_dcs(cluster_name, group)
    cluster = dcs.get_cluster()

    if not cluster.config:
        raise PatroniCtlException('The config key does not exist in the cluster {0}'.format(cluster_name))

    before_editing = format_config_for_editing(cluster.config.data)

    after_editing = None  # Serves as a flag if any changes were requested
    changed_data = cluster.config.data

    if replace_filename:
        after_editing, changed_data = apply_yaml_file({}, replace_filename)

    if apply_filename:
        after_editing, changed_data = apply_yaml_file(changed_data, apply_filename)

    if kvpairs or pgkvpairs:
        all_pairs = list(kvpairs) + ['postgresql.parameters.' + v.lstrip() for v in pgkvpairs]
        after_editing, changed_data = apply_config_changes(before_editing, changed_data, all_pairs)

    # If no changes were specified on the command line invoke editor
    if after_editing is None:
        after_editing, changed_data = invoke_editor(before_editing, cluster_name)

    if cluster.config.data == changed_data:
        if not quiet:
            click.echo("Not changed")
        return

    if not quiet:
        show_diff(before_editing, after_editing)

    if (apply_filename == '-' or replace_filename == '-') and not force:
        click.echo("Use --force option to apply changes")
        return

    if force or click.confirm('Apply these changes?'):
        if not dcs.set_config_value(json.dumps(changed_data, separators=(',', ':')), cluster.config.version):
            raise PatroniCtlException("Config modification aborted due to concurrent changes")
        click.echo("Configuration changed")
Process ``edit-config`` command of ``patronictl`` utility.

    Update or replace Patroni configuration in the DCS.

    :param cluster_name: name of the Patroni cluster.
    :param group: filter which Citus group configuration we should edit. Refer to the module note for more details.
    :param force: if ``True`` apply config changes without asking for confirmations.
    :param quiet: if ``True`` skip showing config diff in the console.
    :param kvpairs: list of key value general parameters to be changed.
    :param pgkvpairs: list of key value Postgres parameters to be changed.
    :param apply_filename: name of the file which contains with new configuration parameters to be applied. Pass ``-``
        for using stdin instead.
    :param replace_filename: name of the file which contains the new configuration parameters to replace the existing
        configuration. Pass ``-`` for using stdin instead.

    :raises:
        :class:`PatroniCtlException`: if
            * Configuration is absent from DCS; or
            * Detected a concurrent modification of the configuration in the DCS.
    
patroni/ctl.py