#!/usr/bin/bash

# init function for the amga service publisher, to export some variables

# These can be overridden by external definitions of the variables,
# e.g. if the advertised host name should be an alias

AMGA_CONF=${AMGA_CONF:-/etc/amgad.config}

AMGA_HOST=${AMGA_HOST:-$(hostname -f)}

AMGA_PORT=$(grep -m 1 ^Port "$AMGA_CONF" | cut -d= -f2)

AMGA_PORT=${AMGA_PORT:-8822}

# Write to stdout - will be imported by the info provider

echo AMGA_HOST="$AMGA_HOST"
echo AMGA_PORT="$AMGA_PORT"
echo AMGA_CONF="$AMGA_CONF"

echo AMGA_PID_FILE=/var/lock/subsys/amgad
