From ee7bbbe09aa9baa7261aa2475ac580ac829b476b Mon Sep 17 00:00:00 2001 From: Ayush <102516633+ayush-billore@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:33:40 +0530 Subject: [PATCH] make onetrust id configurable (#3210) Signed-off-by: ayush-billore --- docs-chef-io/content/supermarket/config_rb_supermarket.md | 6 ++++++ omnibus/cookbooks/omnibus-supermarket/attributes/default.rb | 2 ++ src/supermarket/app/views/application/_analytics.html.erb | 4 ++-- src/supermarket/habitat-web/default.toml | 1 + src/supermarket/habitat-web/plan.sh | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs-chef-io/content/supermarket/config_rb_supermarket.md b/docs-chef-io/content/supermarket/config_rb_supermarket.md index 9e37b0111..40cd9f8f5 100644 --- a/docs-chef-io/content/supermarket/config_rb_supermarket.md +++ b/docs-chef-io/content/supermarket/config_rb_supermarket.md @@ -278,6 +278,12 @@ Use these settings to set up [Google Analytics](https://analytics.google.com) tr Default value: `"false"`. +`default['supermarket']['onetrust_id']` + +: The Onetrust ID for Supermarket. + + Default value: `nil`. + ### Nginx This configuration file has the following settings for nginx: diff --git a/omnibus/cookbooks/omnibus-supermarket/attributes/default.rb b/omnibus/cookbooks/omnibus-supermarket/attributes/default.rb index 170fc7436..ff1e73402 100644 --- a/omnibus/cookbooks/omnibus-supermarket/attributes/default.rb +++ b/omnibus/cookbooks/omnibus-supermarket/attributes/default.rb @@ -453,6 +453,8 @@ default['supermarket']['enable_gtag'] = 'false' # This controls whether your Supermarket will reach out to Onetrust default['supermarket']['enable_onetrust'] = 'false' +# This config enables you to set value of onetrust id +default['supermarket']['onetrust_id'] = nil # ### robots.txt Settings # diff --git a/src/supermarket/app/views/application/_analytics.html.erb b/src/supermarket/app/views/application/_analytics.html.erb index 60e1419f9..b04d621a5 100644 --- a/src/supermarket/app/views/application/_analytics.html.erb +++ b/src/supermarket/app/views/application/_analytics.html.erb @@ -1,5 +1,5 @@ -<% if onetrust_enabled? %> - <%= javascript_include_tag "https://cdn.cookielaw.org/consent/e231efa5-3ed9-4b92-96bc-f4c0872ca486/otSDKStub.js", charset: "UTF-8", "data-domain-script": "e231efa5-3ed9-4b92-96bc-f4c0872ca486", nonce: true %> +<% if onetrust_enabled? && ENV['ONETRUST_ID'].present? %> + <%= javascript_include_tag "https://cdn.cookielaw.org/consent/#{ENV['ONETRUST_ID']}/otSDKStub.js", charset: "UTF-8", "data-domain-script": "#{ENV['ONETRUST_ID']}", nonce: true %> <% end %> <% if gtag_enabled? %> diff --git a/src/supermarket/habitat-web/default.toml b/src/supermarket/habitat-web/default.toml index c2af83361..76fec4100 100644 --- a/src/supermarket/habitat-web/default.toml +++ b/src/supermarket/habitat-web/default.toml @@ -18,6 +18,7 @@ fqdn = '' fqdn_sanitized = '' from_email = '' google_analytics_id = '' +onetrust_id = '' segment_write_key = '' log_level = 'info' serve_static_files = true diff --git a/src/supermarket/habitat-web/plan.sh b/src/supermarket/habitat-web/plan.sh index 3562ea59a..28a8e78ba 100644 --- a/src/supermarket/habitat-web/plan.sh +++ b/src/supermarket/habitat-web/plan.sh @@ -87,6 +87,7 @@ scaffolding_env[GITHUB_KEY]="{{ cfg.github.key }}" scaffolding_env[GITHUB_SECRET]="{{ cfg.github.secret }}" scaffolding_env[GITHUB_URL]="{{ cfg.github.url }}" scaffolding_env[GOOGLE_ANALYTICS_ID]="{{ cfg.app.google_analytics_id }}" +scaffolding_env[ONETRUST_ID]="{{ cfg.app.onetrust_id }}" scaffolding_env[LEARN_CHEF_URL]="{{ cfg.urls.learn_chef_url }}" scaffolding_env[LOG_LEVEL]="{{ cfg.app.log_level }}" scaffolding_env[NEWRELIC_AGENT_ENABLED]="{{ cfg.new_relic.enabled }}"