From c203d17f370d59d258108a729c43d88af9059426 Mon Sep 17 00:00:00 2001 From: Drew Teter Date: Fri, 17 Mar 2023 15:45:29 -0400 Subject: [PATCH] configs fix --- app/models/config.rb | 2 +- .../admin/configs/_trip_planning_apis.html.haml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/config.rb b/app/models/config.rb index 62e7a4cf..cb4fa893 100644 --- a/app/models/config.rb +++ b/app/models/config.rb @@ -74,7 +74,7 @@ def self.method_missing(key, *args, &blk) return Rails.application.config.send(key) if Rails.application.config.respond_to?(key) Rails.logger.warn("Warning: Config #{key} was not found in the database or the application configuration, defaulting to environment") - return ENV[key.to_s] if ENV[key.to_s] + return ENV[key.to_s] if ENV[key.to_s].present? return DEFAULT_CONFIGS[key.to_sym] end diff --git a/app/views/admin/configs/_trip_planning_apis.html.haml b/app/views/admin/configs/_trip_planning_apis.html.haml index e346a6c5..27fdff70 100644 --- a/app/views/admin/configs/_trip_planning_apis.html.haml +++ b/app/views/admin/configs/_trip_planning_apis.html.haml @@ -13,32 +13,32 @@ = f.input :open_trip_planner, required: true, label: "URL of the Open Trip Planner Server", - input_html: {value: @configs.find_by(key: :open_trip_planner).try(:value)}, + input_html: {value: @configs.open_trip_planner}, as: :string = f.input :otp_itinerary_quantity, required: true, label: "The number of Itineraries we request from OTP per transit type. This may be different from the number of Itineraries that are shown", - input_html: {value: @configs.find_by(key: :open_trip_planner).try(:value)}, + input_html: {value: @configs.otp_itinerary_quantity}, as: :integer -# = f.input :otp_max_itineraries_shown, required: true, -# label: "The maximum number of requested Itineraries that we show per transit type.", - -# input_html: {value: @configs.find_by(key: :open_trip_planner).try(:value)}, + -# input_html: {value: @configs.open_trip_planner}, -# as: :integer =f.input :tff_api_key, required: false, label: "API Key for Taxi Fare Finder", - input_html: {value: @configs.find_by(key: :tff_api_key).try(:value)}, + input_html: {value: @configs.tff_api_key}, as: :string =f.input :uber_token, required: false, label: "Uber Token", - input_html: {value: @configs.find_by(key: :uber_token).try(:value)}, + input_html: {value: @configs.uber_token}, as: :string =f.input :lyft_client_token, required: false, label: "Lyft Client Token", - input_html: {value: @configs.find_by(key: :lyft_client_token).try(:value)}, + input_html: {value: @configs.lyft_client_token}, as: :string :javascript