diff options
Diffstat (limited to 'bin/ec2-rewrite-conf')
-rwxr-xr-x | bin/ec2-rewrite-conf | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/ec2-rewrite-conf b/bin/ec2-rewrite-conf new file mode 100755 index 000000000..0163ef511 --- /dev/null +++ b/bin/ec2-rewrite-conf @@ -0,0 +1,20 @@ +#!/bin/sh + +# This is a helper script for writing the current EC2 hostname into +# the FixMyStreet configuration file. Its intended usage is for lines +# like these to be added to /etc/rc.local: +# +# su -l -c /home/fms/fixmystreet/bin/ec2-rewrite-conf fms +# /etc/init.d/apache2 restart + +set -e + +BIN_DIR=$(dirname $(readlink -f $0)) +CONF_DIR=$BIN_DIR/../conf + +HOST=`curl -s http://169.254.169.254/latest/meta-data/public-hostname` + +sed -i -r \ + -e "s,^( *BASE_URL:).*,\\1 'http://$HOST'," \ + -e "s,^( *EMAIL_DOMAIN:).*,\\1 '$HOST'," \ + $CONF_DIR/general.yml |