#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"

trigger-config-docker-args() {
  declare desc="config docker-args plugin trigger"
  declare trigger="docker-args"
  declare APP="$1"
  local ENV_ARGS STDIN

  STDIN=$(cat)

  ENV_ARGS="$(config_export app "$APP" --format docker-args-keys --merged)"
  echo -n "$STDIN $ENV_ARGS"
}

trigger-config-docker-args "$@"
