read_default_result=`echo $read_config_result | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"`
}
+assert_maxmind_license_key() {
+ echo "Checking if $web_file has MAXMIND placeholder."
+ if ! grep DISCOURSE_MAXMIND_LICENSE_KEY $web_file
+ then
+ echo "Adding MAXMIND placeholder to $web_file"
+ sed -i -e 's/LETSENCRYPT_ACCOUNT_EMAIL/a\ \ #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456' $web_file
+ fi
+}
+
##
## prompt user for typical Discourse config file values
##
local letsencrypt_status="Enter 'OFF' to disable."
fi
+ read_config "DISCOURSE_MAXMIND_LICENSE_KEY"
+ local maxmind_license_key=$read_config_result
+ if [ -z $maxmind_license_key ]
+ then
+ maxmind_license_key="1234567890123456"
+ fi
+ if [ "$maxmind_license_key" == "1234567890123456" ]
+ then
+ local maxmind_status="ENTER to continue without MAXMIND GeoLite2 geolocation database"
+ fi
+
read_config "DISCOURSE_HOSTNAME"
hostname=$read_config_result
fi
fi
+ read_config "DISCOURSE_MAXMIND_LICENSE_KEY"
+ local maxmind_license_key=$read_config_result
+ read -p "Optional Maxmind License key ($maxmind_status) [$maxmind_license_key]: " new_value
+ if [ ! -z "$new_value" ]
+ then
+ maxmind_license_key="$new_value"
+ fi
+
echo -e "\nDoes this look right?\n"
echo "Hostname : $hostname"
echo "Email : $developer_emails"
echo "Let's Encrypt : $letsencrypt_account_email"
fi
+ if [ "$maxmind_license_key" != "1234567890123456" ]
+ then
+ echo "Maxmind license: $maxmind_license_key"
+ else
+ echo "Maxmind license: (unset)"
+ fi
echo ""
read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_ok
sed -i -e "s/$src/$dst/w $changelog" $web_file
if [ -s $changelog ]
then
- echo "web.ssl.template.yml enabled"
+ echo "web.ssl.template.yml enabled"
else
update_ok="n"
echo "web.ssl.template.yml NOT ENABLED--was it on already?"
echo "letsencrypt.ssl.template.yml NOT ENABLED -- was it on already?"
fi
+ echo
+ if [ $maxmind_license_key != "1234567890123456" ]
+ then
+ echo "Setting MAXMIND key to $maxmind_license_key in $web_file"
+ sed -i -e "s/^.*DISCOURSE_MAXMIND_LICENSE_KEY:.*/ DISCOURSE_MAXMIND_LICENSE_KEY: $maxmind_license_key/w $changelog" $web_file
+ if [ -s $changelog ]
+ then
+ rm $changelog
+ else
+ echo "DISCOURSE_MAXMIND_LICENSE_KEY change failed."
+ update_ok="n"
+ fi
+ fi
+
if [ "$update_ok" == "y" ]
then
echo -e "\nConfiguration file at $config_file updated successfully!\n"
check_root
check_and_install_docker
check_disk_and_memory
+assert_maxmind_license_key
if [ -a "$web_file" ]
then