#!/bin/sh

# Create JSON files containing the version information, available services, and
# enabled components. These files will be served by the nginx proxy as static files.

THIS_FILE="$(readlink -f "$0" || realpath "$0")"
THIS_DIR="$(dirname "${THIS_FILE}")"

mkdir -p "${THIS_DIR}/static"

echo "${BIRDHOUSE_VERSION_JSON}" > "${THIS_DIR}/static/version.json"
echo "${BIRDHOUSE_DEPLOY_SERVICES_JSON}" > "${THIS_DIR}/static/services.json"
echo "${BIRDHOUSE_DEPLOY_COMPONENTS_JSON}" > "${THIS_DIR}/static/components.json"
