#!/bin/bash

# Copyright (C) Metaswitch Networks 2015
# If license terms are provided to you in a COPYING file in the root directory
# of the source code repository by which you are accessing this code, then
# the license outlined in that COPYING file applies to your use.
# Otherwise no rights are granted except for those provided to you by
# Metaswitch Networks in a separate written agreement.

set -e

if [ $# -ne 1 ]
then
	echo "Usage: migrate_local_config filename"
	exit 1
fi

source $1

cat <<EOF > /etc/clearwater/local_config
local_ip=$local_ip
public_ip=$public_ip
public_hostname=$public_hostname
signaling_namespace=$signaling_namespace
hs_diameteridentity=$hs_diameteridentity
ralf_diameteridentity=$ralf_diameteridentity
etcd_cluster=$etcd_cluster
node_idx=$node_idx
alias_list=$alias_list

local_site_name=$local_site_name
remote_site_name=$remote_site_name
EOF

# Comment out any blank values
perl -p -i -e 's/^(.*=)$/#$1/' /etc/clearwater/local_config
