#!/bin/sh
# argos — EDON Argos from the shell (argos-cli). The appliance's Deno (edon-deno) runs it: --no-config, so a deno.json in
# the current directory changes nothing; no network but the console's Unix socket; the modules compiled by the postinst
# are in /var/cache/argos-cli (root's: another account compiles them in its own cache, and cannot reach the socket anyway).
if [ -w /var/cache/argos-cli ]; then
  DENO_DIR=/var/cache/argos-cli
  export DENO_DIR
fi
# The one socket the command may reach (Deno asks for it as net access).
SOCKET="${ARGOS_CLI_SOCKET:-/run/argos/cli.sock}"
exec /usr/bin/deno run --quiet --no-prompt --no-config "--allow-net=unix:$SOCKET" --allow-read --allow-write --allow-env /usr/lib/argos-cli/src/main.ts "$@"
