#!/bin/bash
# Load.
source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load
# Parameters
BASENAME="`basename $0`"
PARAM="$1"
YAML_FILE="$2"
DEFAULT="$3"
# Check
if [ -z "$2" ]; then
echo "usage: $BASENAME [default-value]"
exit 1
elif [ ! -e "$YAML_FILE" ]; then
echo "file not found: $YAML_FILE"
exit 1
fi
# Dispatch
PARAM="`hydra_yaml_param $PARAM $YAML_FILE`"
# Display
if [ ! -z "$PARAM" ]; then
echo "$PARAM"
elif [ ! -z "$DEFAULT" ]; then
echo "$DEFAULT"
fi