Skip to content

Commit

Permalink
feat: env flag to disable intercom (#6937)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhsaxena authored Aug 30, 2021
1 parent 1add6c9 commit 4938371
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ APPSMITH_MAIL_SMTP_TLS_ENABLED=
# Google Recaptcha Config
APPSMITH_RECAPTCHA_SITE_KEY=
APPSMITH_RECAPTCHA_SECRET_KEY=
APPSMITH_RECAPTCHA_ENABLED=
APPSMITH_RECAPTCHA_ENABLED=

# Intercom
APPSMITH_DISABLE_INTERCOM=
1 change: 1 addition & 0 deletions app/client/docker/templates/nginx-app.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ server {
sub_filter __APPSMITH_DISABLE_TELEMETRY__ '${APPSMITH_DISABLE_TELEMETRY}';
sub_filter __APPSMITH_CLOUD_SERVICES_BASE_URL__ '${APPSMITH_CLOUD_SERVICES_BASE_URL}';
sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '${APPSMITH_RECAPTCHA_SITE_KEY}';
sub_filter __APPSMITH_DISABLE_INTERCOM__ '${APPSMITH_DISABLE_INTERCOM}';
}

location /f {
Expand Down
3 changes: 2 additions & 1 deletion app/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@
const INTERCOM_APP_ID = parseConfig("%REACT_APP_INTERCOM_APP_ID%") || parseConfig("__APPSMITH_INTERCOM_APP_ID__");
const CLOUD_HOSTING = parseConfig("__APPSMITH_CLOUD_HOSTING__");
const DISABLE_TELEMETRY = parseConfig("__APPSMITH_DISABLE_TELEMETRY__");
const DISABLE_INTERCOM = parseConfig("__APPSMITH_DISABLE_INTERCOM__");

// Initialize the Intercom library
if (INTERCOM_APP_ID.length) {
if (INTERCOM_APP_ID.length && !DISABLE_INTERCOM) {
(function () { var w = window; var ic = w.Intercom; if (typeof ic === "function") { ic('reattach_activator'); ic('update', w.intercomSettings); } else { var d = document; var i = function () { i.c(arguments); }; i.q = []; i.c = function (args) { i.q.push(args); }; w.Intercom = i; var l = function () { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://widget.intercom.io/widget/' + INTERCOM_APP_ID; var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); }; if (document.readyState === 'complete') { l(); } else if (w.attachEvent) { w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } })();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const HELP_MENU_ITEMS: HelpItem[] = [
},
];

if (intercomAppID) {
if (intercomAppID && window.Intercom) {
HELP_MENU_ITEMS.push({
icon: <StyledChatIcon color="#fff" height={14} width={11.2} />,
label: "Chat with us",
Expand Down
2 changes: 1 addition & 1 deletion deploy/ansible/appsmith_playbook/appsmith-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ intercom_app_id: ''
google_recaptcha_site_key: ''
google_recaptcha_secret_key: ''
google_recaptcha_enabled: 'false'

disable_intercom: 'false'
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ APPSMITH_RECAPTCHA_SITE_KEY= {{ google_recaptcha_site_key }}
APPSMITH_RECAPTCHA_SECRET_KEY= {{ google_recaptcha_secrete_key }}
APPSMITH_RECAPTCHA_ENABLED= {{ google_recaptcha_enabled }}
# ********************************

# ******** Intercom **************
APPSMITH_DISABLE_INTERCOM= {{ disable_intercom }}
# ********************************
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '{{ google_recaptcha_site_key }}';
sub_filter __APPSMITH_RECAPTCHA_SECRET_KEY__ '{{ google_recaptcha_secrete_key }}';
sub_filter __APPSMITH_RECAPTCHA_ENABLED__ '{{ google_recaptcha_enabled }}';
sub_filter __APPSMITH_DISABLE_INTERCOM__ '{{ disable_intercom }}';
}

location /f {
Expand Down Expand Up @@ -99,6 +100,7 @@
{{ ssl_cmt }} sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '{{ google_recaptcha_site_key }}';
{{ ssl_cmt }} sub_filter __APPSMITH_RECAPTCHA_SECRET_KEY__ '{{ google_recaptcha_secrete_key }}';
{{ ssl_cmt }} sub_filter __APPSMITH_RECAPTCHA_ENABLED__ '{{ google_recaptcha_enabled }}';
{{ ssl_cmt }} sub_filter __APPSMITH_DISABLE_INTERCOM__ '{{ disable_intercom }}';
{{ ssl_cmt }} }

{{ ssl_cmt }} location /f {
Expand Down
2 changes: 2 additions & 0 deletions deploy/heroku/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Quickly set up Appsmith to explore product functionality using Heroku.
- `APPSMITH_RECAPTCHA_SITE_KEY`: Google reCAPTCHA v3 site key, it is required if you wish to enable protection against spam/abusive users. Read more at: https://developers.google.com/recaptcha/docs/v3
- `APPSMITH_RECAPTCHA_SECRET_KEY`: Google reCAPTCHA v3 verification secret key, it is required if you wish to enable spam protection in your backend server.
- `APPSMITH_RECAPTCHA_ENABLED`: Boolean config to enable or disable Google reCAPTCHA v3 verification feature. If set to true, both site key and secret key should be provided.
- Intercom:
- `APPSMITH_DISABLE_INTERCOM`: Set this value to true to disable intercom (value should be `true/false` only)

After Heroku finishes setting up the app, click “View” and your Appsmith should be up and running. You will be taken to the account creation page, where you can enter credentials to create an account and get started.

Expand Down
1 change: 1 addition & 0 deletions deploy/heroku/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ server {
sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '${APPSMITH_RECAPTCHA_SITE_KEY}';
sub_filter __APPSMITH_RECAPTCHA_SECRET_KEY__ '${APPSMITH_RECAPTCHA_SECRET_KEY}';
sub_filter __APPSMITH_RECAPTCHA_ENABLED__ '${APPSMITH_RECAPTCHA_ENABLED}';
sub_filter __APPSMITH_DISABLE_INTERCOM__ '${APPSMITH_DISABLE_INTERCOM}';
}

location /f {
Expand Down
1 change: 1 addition & 0 deletions deploy/k8s/scripts/appsmith-configmap.yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ data:
APPSMITH_RECAPTCHA_SITE_KEY: ""
APPSMITH_RECAPTCHA_SECRET_KEY: ""
APPSMITH_RECAPTCHA_ENABLED: "false"
APPSMITH_DISABLE_INTERCOM: "false"
EOF
1 change: 1 addition & 0 deletions deploy/k8s/scripts/nginx-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ data:
sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '${APPSMITH_RECAPTCHA_SITE_KEY}';
sub_filter __APPSMITH_RECAPTCHA_SECRET_KEY__ '${APPSMITH_RECAPTCHA_SECRET_KEY}';
sub_filter __APPSMITH_RECAPTCHA_ENABLED__ '${APPSMITH_RECAPTCHA_ENABLED}';
sub_filter __APPSMITH_DISABLE_INTERCOM__ '${APPSMITH_DISABLE_INTERCOM}';
}
location /f {
Expand Down
4 changes: 4 additions & 0 deletions deploy/template/docker.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ APPSMITH_DISABLE_TELEMETRY=$disable_telemetry
# APPSMITH_RECAPTCHA_ENABLED=
# ************************************
# ******** INTERCOM *************
# APPSMITH_DISABLE_INTERCOM=
# *******************************
EOF
2 changes: 2 additions & 0 deletions deploy/template/nginx_app.conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ $NGINX_SSL_CMNT server_name $custom_domain ;
sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '\${APPSMITH_RECAPTCHA_SITE_KEY}';
sub_filter __APPSMITH_RECAPTCHA_SECRET_KEY__ '\${APPSMITH_RECAPTCHA_SECRET_KEY}';
sub_filter __APPSMITH_RECAPTCHA_ENABLED__ '\${APPSMITH_RECAPTCHA_ENABLED}';
sub_filter __APPSMITH_DISABLE_INTERCOM__ '\${APPSMITH_DISABLE_INTERCOM}';
}
location /f {
Expand Down Expand Up @@ -112,6 +113,7 @@ $NGINX_SSL_CMNT sub_filter __APPSMITH_DISABLE_TELEMETRY__ '\${APPSMITH_DI
$NGINX_SSL_CMNT sub_filter __APPSMITH_RECAPTCHA_SITE_KEY__ '\${APPSMITH_RECAPTCHA_SITE_KEY}';
$NGINX_SSL_CMNT sub_filter __APPSMITH_RECAPTCHA_SECRET_KEY__ '\${APPSMITH_RECAPTCHA_SECRET_KEY}';
$NGINX_SSL_CMNT sub_filter __APPSMITH_RECAPTCHA_ENABLED__ '\${APPSMITH_RECAPTCHA_ENABLED}';
$NGINX_SSL_CMNT sub_filter __APPSMITH_DISABLE_INTERCOM__ '\${APPSMITH_DISABLE_INTERCOM}';
$NGINX_SSL_CMNT }
$NGINX_SSL_CMNT
$NGINX_SSL_CMNT location /f {
Expand Down

0 comments on commit 4938371

Please sign in to comment.