#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$(dirname "$(dirname "${BASH_SOURCE[0]}")")/functions"

cmd-google-auth-logs() {
  declare desc="show logs from the shared auth service container"
  local cmd="google-auth:logs"
  [[ "$1" == "$cmd" ]] && shift 1

  local args=(--tail 100)
  if [[ "${1:-}" == "--tail" || "${1:-}" == "-t" ]]; then
    args=(--tail 100 --follow)
  fi
  docker container logs "${args[@]}" "$GOOGLE_AUTH_SERVICE_NAME"
}

cmd-google-auth-logs "$@"
