#!/bin/sh

for file in /app/assets/*.js
do
  sed -i 's|ENV_API_BASE_URL|'${API_BASE_URL}'|g' $file
  sed -i 's|ENV_KC_URL|'${KC_URL}'|g' $file
  sed -i 's|ENV_KC_REALM|'${KC_REALM}'|g' $file
  sed -i 's|ENV_KC_CLIENT_ID|'${KC_CLIENT_ID}'|g' $file
  sed -i 's|ENV_EDM_MICRO_FRONTEND_URL|'${EDM_MICRO_FRONTEND_URL}'|g' $file
  sed -i 's|ENV_API_BASE_OCR_URL|'${API_BASE_OCR_URL}'|g' $file
done

miniserve --spa --index index.html
