#!/usr/bin/env bash
. ./cmd/env

pkg_update () {
    cd ../
    warning "For this command to work in docker you need to edit: ./ob/alpha-compose.override.yml:"
    info "
  backend:
    volumes:
      - ../backend/app:/app/
#     - ../backend/osintbuddy-plugins:/tmp/osintbuddy-plugins # <- uncomment me"
    if [ -d "venv" ]; then
        . venv/bin/activate
        pip install backend/osintbuddy-plugins

        ob_compose exec backend pip install /tmp/osintbuddy-plugins
        ob_compose restart backend
        # ob_compose restart janus # crappy fix for when first janus restart fails
        success "The osintbuddy Python package has been updated locally and in docker!"
    else
        error "Error: Python venv not found!"
        info "Try running the following command to configure your environment:"
        info "      ./launcher bootstrap"
        exit 1
    fi
}

pkg_update


