#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
	exit
fi

if (( $# != 6 )); then
    echo "usage: $0 <config_tempate> <spotify_username> <spotify_password> <spotify_client_id> <spotify_client_secret> <soundcloud_auth_token>"
	exit 1
fi

export SPOTIFY_USERNAME="$2"
export SPOTIFY_PASSWORD="$3"
export SPOTIFY_CLIENT_ID="$4"
export SPOTIFY_CLIENT_SECRET="$5"
export SOUNDCLOUD_AUTH_TOKEN="$6"

envsubst < $1 > /etc/mopidy/mopidy.conf
