@@ -5,9 +5,6 @@ AIRTIME_APACHE_CONFIG="/etc/apache2/sites-enabled/airtime.conf"
5
5
# Script that is executed to apply further customizations to airtime.
6
6
CUSTOMISATIONS_SCRIPT=" /etc/airtime-customisations/run.sh"
7
7
8
- # Airtime seems to expect the hostname of 'airtime' to be set to properly function...
9
- echo " 127.0.0.1 airtime libretime" >> /etc/hosts
10
-
11
8
function setConfigFromEnvironments {
12
9
13
10
# RabbitMQ
@@ -36,21 +33,20 @@ function setConfigFromEnvironments {
36
33
37
34
function apacheFixes() {
38
35
39
- if ! grep -q ' BEGIN:LOCALHOSTFIX --' " $AIRTIME_APACHE_CONFIG "
36
+ if ! grep -q ' BEGIN:WEBPORTFIX --' " $AIRTIME_APACHE_CONFIG "
40
37
then
41
38
42
39
# Add in a "Substitute" filter to apache to strip out localhost references on the fly...
43
- sed -i ' s^.*</VirtualHost>.*^ # Quick fix for iframes that reference hard coded localhost in paths .\n # BEGIN:LOCALHOSTFIX --\n <Location "/">\n SetOutputFilter SUBSTITUTE;DEFLATE\n AddOutputFilterByType SUBSTITUTE text/html\n Substitute "s|http://localhost//|/ |ni"\n Substitute "s|https://localhost//|/| ni"\n Substitute "s|http://localhost/|/ |ni"\n Substitute "s|https://localhost/|/ |ni"\n </Location>\n&^' " $AIRTIME_APACHE_CONFIG "
40
+ sed -i ' s^.*</VirtualHost>.*^ # Quick fix for iframes and assets that load the EXTERNAL_HOSTNAME without a port .\n # BEGIN:WEBPORTFIX --\n <Location "/">\n SetOutputFilter SUBSTITUTE;DEFLATE\n AddOutputFilterByType SUBSTITUTE text/html\n Substitute "s|' $EXTERNAL_HOSTNAME ' /embed| ' $EXTERNAL_HOSTNAME ' : ' $WEB_UI_PORT ' /embed|ni"\n Substitute "s| ' $EXTERNAL_HOSTNAME ' /js| ' $EXTERNAL_HOSTNAME ' : ' $WEB_UI_PORT ' /js |ni"\n Substitute "s|' $EXTERNAL_HOSTNAME ' //css| ' $EXTERNAL_HOSTNAME ' : ' $WEB_UI_PORT ' //css|ni"\n Substitute "s| ' $EXTERNAL_HOSTNAME ' /css| ' $EXTERNAL_HOSTNAME ' : ' $WEB_UI_PORT ' /css| ni"\n Substitute "s|' $EXTERNAL_HOSTNAME ' /widgets| ' $EXTERNAL_HOSTNAME ' : ' $WEB_UI_PORT ' /widgets |ni"\n Substitute "s|' $EXTERNAL_HOSTNAME ' /api| ' $EXTERNAL_HOSTNAME ' : ' $WEB_UI_PORT ' /api |ni"\n </Location>\n&^' " $AIRTIME_APACHE_CONFIG "
44
41
45
42
a2enmod substitute
46
43
fi
44
+ }
47
45
48
- if ! grep -q " $EXTERNAL_HOSTNAME " " $AIRTIME_APACHE_CONFIG "
49
- then
50
- # Fix localhost on "Radio Embed Page"
51
- sed -i ' s^.*</Location>.*^ Substitute "s|http:\\/\\/localhost:8000|http:\\/\\/' " $EXTERNAL_HOSTNAME " ' |ni"\n&^' " $AIRTIME_APACHE_CONFIG "
52
- fi
53
-
46
+ function fqdnFixes() {
47
+ # Airtime seems to expect the hostname of 'airtime' to be set to properly function...
48
+ # EXTERNAL_HOSTNAME necessary in order to connect to icecast when setting custom output streams
49
+ echo " 127.0.0.1 airtime libretime $EXTERNAL_HOSTNAME " >> /etc/hosts
54
50
}
55
51
56
52
function customisations() {
@@ -66,13 +62,13 @@ if [ ! -f "$AIRTIME_CONFIG_FILE" ]; then
66
62
/opt/libretime/firstrun.sh
67
63
68
64
# update config based on environment variables...
69
- setConfigFromEnvironments && apacheFixes && customisations
65
+ setConfigFromEnvironments && apacheFixes && customisations && fqdnFixes
70
66
71
67
# Start everything up :)
72
68
/usr/bin/supervisord
73
69
else
74
70
# Check (and update if required) any config based on environment variables..
75
- setConfigFromEnvironments && apacheFixes && customisations
71
+ setConfigFromEnvironments && apacheFixes && customisations && fqdnFixes
76
72
77
73
# We're already installed - just run supervisor..
78
74
/usr/bin/supervisord
0 commit comments