blob: 0163ef511e97a5a896e13509f4ba290cfd431131 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
|