From 3596dc168652282a50d569afc7ca8399d88b740d Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 9 May 2024 15:40:01 +0800 Subject: [PATCH] FEATURE: Update `discourse-setup` to prompt for MaxMind account ID (#796) In order to download the free MaxMind GeoLite2 databases, an account ID and license key is required going forward. This commit updates `discourse-setup` to start prompting the user to provide the MaxMind Account ID first before asking for the MaxMind license key. If the user does not provide the Account ID, the script will not prompt for the license key as we assume the user has opted out. We are aware that we don't have a reliable way to test for changes to the `discourse-setup` script but it is what it is at this point in time. We intend to invest resources in improving things in the future but now is not the time. --- discourse-setup | 83 ++++++++++++++++++++++++++++++++---------- samples/standalone.yml | 7 ++-- samples/web_only.yml | 7 ++-- 3 files changed, 72 insertions(+), 25 deletions(-) diff --git a/discourse-setup b/discourse-setup index 1e5df5e..a037100 100755 --- a/discourse-setup +++ b/discourse-setup @@ -354,21 +354,29 @@ read_default() { read_default_result=`echo $read_config_result | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"` } -assert_maxmind_license_key() { +assert_maxmind_envs() { if ! grep DISCOURSE_MAXMIND_LICENSE_KEY $web_file >/dev/null 2>&1 then - echo "Adding MAXMIND placeholder to $web_file" + echo "Adding MAXMIND_LICENSE_KEY placeholder to $web_file" sed -i '/^.*LETSENCRYPT_ACCOUNT_EMAIL.*/a \ \ #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456' $web_file fi - if ! grep DISCOURSE_MAXMIND_LICENSE_KEY $web_file >/dev/null 2>&1 + + if ! grep DISCOURSE_MAXMIND_ACCOUNT_ID $web_file >/dev/null 2>&1 + then + echo "Adding MAXMIND_ACCOUNT_ID placeholder to $web_file" + sed -i '/^.*LETSENCRYPT_ACCOUNT_EMAIL.*/a \ \ #DISCOURSE_MAXMIND_ACCOUNT_ID: 123456' $web_file + fi + + + if ! grep -e DISCOURSE_MAXMIND_LICENSE_KEY -e DISCOURSE_MAXMIND_ACCOUNT_ID $web_file >/dev/null 2>&1 then cat <