#!/usr/bin/env -S bash -e

# Log function
function log {
  printf '[%s] [%s] %s\n' "${0##*/}" "$( date '+%Y-%m-%dT%H:%M:%S' )" "${@}"
}

# Add task scale-in protection
#log 'Setting task protection'
#curl -X PUT "${ECS_AGENT_URI}/task-protection/v1/state" -d '{"ProtectionEnabled":true, "ExpiresInMinutes":1440}'
#log "Current task protection: $(curl -X GET "${ECS_AGENT_URI}"/task-protection/v1/state)"

log 'Running app...'
ddtrace-run python3 -m src.app
