def METHOD_NAME(ctx, path, index, value, as_json=False):
    """Inserts value at index of list behind config key."""
    path = _to_settings_path(path)
    if as_json:
        try:
            value = json.loads(value)
        except Exception as e:
            click.echo(str(e), err=True)
            ctx.exit(-1)
    current = ctx.obj.settings.get(path)
    if current is None:
        current = []
    if not isinstance(current, list):
        click.echo("Cannot insert into non-list value at given path", err=True)
        ctx.exit(-1)
    current.insert(index, value)
    _set_helper(ctx.obj.settings, path, current)