From 98de8b6c464512a46231cf2351a15990933a5897 Mon Sep 17 00:00:00 2001 From: Amree Zaid Date: Sat, 3 Aug 2024 08:04:47 +0800 Subject: [PATCH] Use Google API keys from ENV --- .env | 4 +++- app/services/google_api/google_location_syncer.rb | 2 +- app/services/lat_lng_extractor.rb | 2 +- app/services/update_coffee_shop_operation_status.rb | 2 +- app/use_cases/google_apis/opening_hours/fetch.rb | 2 +- app/views/coffee_shops/edit.html.erb | 2 +- app/views/coffee_shops_v2/new.html.erb | 2 +- config/credentials/production.yml.enc | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.env b/.env index f0e05b6f..0ab248b1 100644 --- a/.env +++ b/.env @@ -1,8 +1,10 @@ BUGSNAG_API_KEY= -CLOUDFLARE_TURNSTILE_SITE_KEY= CLOUDFLARE_TURNSTILE_SECRET_KEY= +CLOUDFLARE_TURNSTILE_SITE_KEY= DIGITAL_OCEAN_ACCESS_KEY_ID= DIGITAL_OCEAN_SECRET_ACCESS_KEY= +GOOGLE_API_KEY_API= +GOOGLE_API_KEY_WEB= GOOGLE_OAUTH_CLIENT_ID= GOOGLE_OAUTH_CLIENT_SECRET= MAPBOX_API_KEY= diff --git a/app/services/google_api/google_location_syncer.rb b/app/services/google_api/google_location_syncer.rb index e5991b8a..21c83e01 100644 --- a/app/services/google_api/google_location_syncer.rb +++ b/app/services/google_api/google_location_syncer.rb @@ -35,7 +35,7 @@ def call private def api_key - Rails.application.credentials.dig(:google_api_key, :api) + ENV.fetch("GOOGLE_API_KEY_API") end def validate_params diff --git a/app/services/lat_lng_extractor.rb b/app/services/lat_lng_extractor.rb index bc0338bd..57526571 100644 --- a/app/services/lat_lng_extractor.rb +++ b/app/services/lat_lng_extractor.rb @@ -29,7 +29,7 @@ def valid? end def google_map_api_key - Rails.application.credentials.dig(:google_api_key, :api) + ENV.fetch("GOOGLE_API_KEY_API") end def extract_using_redirection diff --git a/app/services/update_coffee_shop_operation_status.rb b/app/services/update_coffee_shop_operation_status.rb index b4bc674a..a4f90cda 100644 --- a/app/services/update_coffee_shop_operation_status.rb +++ b/app/services/update_coffee_shop_operation_status.rb @@ -47,7 +47,7 @@ def place_id end def api_key - Rails.application.credentials.dig(:google_api_key, :api) + ENV.fetch("GOOGLE_API_KEY_API") end def service diff --git a/app/use_cases/google_apis/opening_hours/fetch.rb b/app/use_cases/google_apis/opening_hours/fetch.rb index 81aca5cf..39ab4538 100644 --- a/app/use_cases/google_apis/opening_hours/fetch.rb +++ b/app/use_cases/google_apis/opening_hours/fetch.rb @@ -21,7 +21,7 @@ def call! private def api_key - Rails.application.credentials.dig(:google_api_key, :api) + ENV.fetch("GOOGLE_API_KEY_API") end def response diff --git a/app/views/coffee_shops/edit.html.erb b/app/views/coffee_shops/edit.html.erb index 16e9ab71..82641a19 100644 --- a/app/views/coffee_shops/edit.html.erb +++ b/app/views/coffee_shops/edit.html.erb @@ -1,5 +1,5 @@ <%= content_for(:extra_js) do %> -<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{Rails.application.credentials.dig(:google_api_key, :web)}&libraries=places&callback=dispatchMapsFormEvent", +<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{ENV.fetch('GOOGLE_API_KEY_WEB')}&libraries=places&callback=dispatchMapsFormEvent", async: true, defer: true, "data-turbolinks-eval": false %> diff --git a/app/views/coffee_shops_v2/new.html.erb b/app/views/coffee_shops_v2/new.html.erb index dea129be..64445365 100644 --- a/app/views/coffee_shops_v2/new.html.erb +++ b/app/views/coffee_shops_v2/new.html.erb @@ -1,5 +1,5 @@ <%= content_for(:extra_js) do %> -<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{Rails.application.credentials.dig(:google_api_key, :web)}&libraries=places&callback=dispatchMapsFormEvent", +<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{ENV.fetch('GOOGLE_API_KEY_WEB')}&libraries=places&callback=dispatchMapsFormEvent", async: true, defer: true, "data-turbolinks-eval": false %> diff --git a/config/credentials/production.yml.enc b/config/credentials/production.yml.enc index 0916ac1a..40f4291b 100644 --- a/config/credentials/production.yml.enc +++ b/config/credentials/production.yml.enc @@ -1 +1 @@ -55p2ArB9wGWFIe3O5ZgRIR0ZhTiphiTzkAk8zqDR6D0AtNnGyrP5SPuCq/pPuPne/bi7ZrdV6NkxDr5mGEjuKDm8lr5DXPMBLIRqXWkIwc2KM5xHLAQy2F9vzqDLHBbxn8rXJbfQG3OAaiAQid1fYW2OMhgnUQKHmXli2IvZNdJ4zkF4dHZ4DHFvxAIZY8xpz43IPDpMMYH1HVQ9v9wiGNZ4oBIWiDsVQ49gIVIcG2yZM8rZTl7FrG5G3prTY2In19OJQSajqoLhVZoJAyTt49ZT75KputV/STVaz+JY69LcoJfGTt0C3+15S0rLGS597qVFjXVZRf2DB1DYsKGRyu+x8CyvqDq0JvMC1+Ul5CUtCgNUHr6O842WIAEw71HTszXM7o9D/vf025CYXgZkKZkKUi1DjAwE8x9zNiLQPTKROGuCzYzL2QQRmwCYg2euarTc8L9oPOdzEXgPRzAARgdWRInh5gCAhP0o/aMA/UoOXwPOWpV0dqI9ZUvBHkSlZ08WKFqtOPQjNMWzOZGFM6Mncav/GQ84F/1Jv/xf1PKVSJTAwQneqDt80Pzk21lDN7aXPo89XJ2ujx/vIsO2SHZvpJ8dXBpWewscHtooDu9lrrmEh9y3AjXzSrehTMZDHC8HilF6cL1JzVsc0qlN+jCCORvImfoQndCLoZoLuXyg/Li50sOgllAFkSy9GtgSstQe8pN87TOdUZHVajeUWz8syrRH2ZQSmAD4WZ8+l/6BIQFgSwIvPBJ/F6bukXyPm/K9Ktih3LaoFHHZ/1WQFpUqRc21HJjKOvNuB0yu5aQj4gMpgqDT8Sj5O6tu4T00tIi5QU8MOZ9e3Hk3EAFgzEXzwJaeHL0H/Qany+0eAbgPC0MDjmI7pPqnv1fcGM9op3AtwNwaFvjOTFG/f/zhqYR+lLBgSoqdSOt4agyt29D9PIgJtWjt5nyweswrugYY9ATmwLefJV6KiRw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