procs:
  mobile:
    cwd: <CONFIG_DIR>/holi-frontends
    env:
      DEV_ENV: local
    shell: ./mprocs-start-mobile.sh
  web:
    cwd: <CONFIG_DIR>/holi-frontends
    env:
      DEV_ENV: local
    shell: ./mprocs-start-web.sh
  storybook (holi-bricks web):
    cwd: <CONFIG_DIR>/holi-frontends
    shell: >
      if [ "$LOCAL_BACKEND_STORYBOOK" = "true" ]; then
        ./mprocs-start-holi-bricks.sh;
      else
        echo "Not starting local Storybook for holi-bricks because LOCAL_BACKEND_STORYBOOK is not set to 'true'";
      fi
  storybook (legacy):
    cwd: <CONFIG_DIR>/holi-frontends
    shell: >
      if [ "$LOCAL_BACKEND_STORYBOOK" = "true" ]; then
        ./mprocs-start-storybook.sh;
      else
        echo "Not starting local Storybook because LOCAL_BACKEND_STORYBOOK is not set to 'true'";
      fi
  adb reverse:
    shell: >
      if adb reverse tcp:4455 tcp:4455; then
        echo 'Android should now be able to communicate with oathkeeper / unified api'
      else
        echo 'There is no running android device. If you start one, please rerun this command'
      fi
  pubsub-emulator:
    cwd: <CONFIG_DIR>/pubsub
    shell: ./mprocs-start.sh
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  oathkeeper:
    cwd: <CONFIG_DIR>/holi-unified-api/oathkeeper
    shell: ../mprocs-start-oathkeeper.sh
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  unified-api:
    cwd: <CONFIG_DIR>/holi-unified-api
    shell: ./mprocs-start.sh
  okuna-services:
    cwd: <CONFIG_DIR>/holi-okuna
    shell: >
      ./mprocs-start-services.sh;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  okuna-server:
    cwd: <CONFIG_DIR>/holi-okuna
    # Before starting the server process, the services need to be up. Therefore, we wait until the services are up via a small until loop.
    shell: >
      ./mprocs-start.sh;
  geo-api:
    cwd: <CONFIG_DIR>/holi-geo-api
    shell: >
      . ../.envrc.local.backends;
      . ./.envrc.local;
      vr install;
      if [ "$LOCAL_BACKEND_GEOAPI" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  donations-api:
    cwd: <CONFIG_DIR>/holi-app-donations
    shell: >
      . ../.envrc.local.backends;
      vr install;
      if [ "$LOCAL_BACKEND_DONATIONS" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  goodnews-api:
    cwd: <CONFIG_DIR>/holi-app-goodnews
    shell: >
      . ../.envrc.local.backends;
      . ./.envrc.local;
      vr install;
      if [ "$LOCAL_BACKEND_GOODNEWS" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  volunteering-api:
    cwd: <CONFIG_DIR>/holi-app-volunteering
    shell: >
      . ../.envrc.local.backends;
      . ./.envrc.local;
      vr install;
      if [ "$LOCAL_BACKEND_VOLUNTEERING" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  notifications-api:
    cwd: <CONFIG_DIR>/holi-notifications
    shell: >
      . ../.envrc.local.backends;
      . ./.envrc.local;
      vr install;
      if [ "$LOCAL_BACKEND_NOTIFICATIONS" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  app-events:
    cwd: <CONFIG_DIR>/holi-app-events
    shell: >
      . ../.envrc.local.backends;
      . ./.envrc.local;
      deno install;
      if [ "$LOCAL_BACKEND_EVENTS" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  translation-api:
    cwd: <CONFIG_DIR>/holi-translation-api
    shell: >
      . ../.envrc.local.backends;
      . ./.envrc.local;
      vr install;
      if [ "$LOCAL_BACKEND_TRANSLATION" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo starting fake;
        FAKE="true" ./mprocs-start.sh;
      fi;
  libretranslate:
    cwd: <CONFIG_DIR>/holi-libretranslate
    shell: >
      if [ "$LOCAL_BACKEND_LIBRETRANSLATE" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo "Not starting local LibreTranslate because LOCAL_BACKEND_LIBRETRANSLATE is not set to 'true'";
      fi;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  ocis:
    cwd: <CONFIG_DIR>/holi-ocis
    shell: >
      if [ "$LOCAL_BACKEND_OCIS" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo "Not starting local ocis because LOCAL_BACKEND_OCIS is not set to 'true'";
      fi;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  ocis-subscriber:
    cwd: <CONFIG_DIR>/holi-ocis-integration
    shell: >
      if [ "$LOCAL_BACKEND_OCIS" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo "Not starting local ocis subscriber because LOCAL_BACKEND_OCIS is not set to 'true'";
      fi;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  chat-server:
    cwd: <CONFIG_DIR>/holi-chat-server
    shell: >
      . ../.envrc.local.backends;
      if [ "$LOCAL_BACKEND_CHAT" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo "Not starting local chat because LOCAL_BACKEND_CHAT is not set to 'true'";
      fi;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  chat-subscriber:
    cwd: <CONFIG_DIR>/holi-chat-integration
    shell: >
      if [ "$LOCAL_BACKEND_CHAT" = "true" ]; then
        ./mprocs-start.sh;
      else
        echo "Not starting local chat subscriber because LOCAL_BACKEND_CHAT is not set to 'true'";
      fi;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
  moderation:
    cwd: <CONFIG_DIR>/holi-moderation
    env:
      DEV_ENV: local
    shell: >
      corepack yarn install;
      if [ "$LOCAL_MODERATION" = "true" ]; then
        corepack yarn start
      else
        echo starting fake;
        corepack yarn build;
        corepack yarn start-fake;
      fi;
    stop:
      send-keys:
        - <C-c>
        - <C-c>
