Skip to content
Open
5 changes: 4 additions & 1 deletion waiter/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ run Travis::Web::App.build(
enable_feature_flags: ENV['ENABLE_FEATURE_FLAGS'],
stripe_publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
default_provider: ENV['DEFAULT_PROVIDER'],
log_limit: ENV['LOG_LIMIT']
log_limit: ENV['LOG_LIMIT'],
auth_endpoint: ENV['AUTH_ENDPOINT'],
api_trace_endpoint: ENV['API_TRACE_ENDPOINT'],
intercom_app_id: ENV['INTERCOM_APP_ID']
)
end
48 changes: 48 additions & 0 deletions waiter/lib/travis/web/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit
config['featureFlags']['enterprise-version'] = true
end

if ENV['REDIRECT']
config['featureFlags']['redirect'] = true
end

if options[:github_apps_app_name]
config['githubApps'] ||= {}
config['githubApps']['appName'] = options[:github_apps_app_name]
Expand All @@ -222,6 +226,8 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit

config['defaultTitle'] = title
config['apiEndpoint'] = options[:api_endpoint] if options[:api_endpoint]
config['authEndpoint'] = options[:auth_endpoint] if options[:auth_endpoint]
config['apiTraceEndpoint'] = options[:api_trace_endpoint] if options[:api_trace_endpoint]
config['githubAppsEndpoint'] = options[:github_apps_endpoint]
source_endpoint = options[:source_endpoint]
if source_endpoint
Expand Down Expand Up @@ -262,6 +268,10 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit
config['providers'][provider]['isDefault'] = true
end

config['intercom'] ||= {}
config['intercom']['appid']= options[:intercom_app_id] || 'placeholder'
config['intercom']['enabled'] = !!options[:intercom_app_id]

if ENV['ENDPOINT_PORTFOLIO']
config['providers'] ||= {}
config['providers']['assembla'] ||= {}
Expand All @@ -286,10 +296,48 @@ def set_config(string, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexit
config['disableAida'] = ENV['DISABLE_AIDA']
end

config['metricsAdapters'] = []

if ENV['GOOGLE_ANALYTICS_ID']
config['metricsAdapters'].push({
name: 'GoogleAnalytics',
environments: ['development', 'production'],
config: {
id: ENV['GOOGLE_ANALYTICS_ID'],
debug: @options[:environment] === 'development',
trace: @options[:environment] === 'development',
sendHitTask: @options[:environment] != 'development'
}
})
end
if ENV['GOOGLE_TAGS_CONTAINER_ID']
config['metricsAdapters'].push({
name: 'GoogleTagManager',
environments: ['development', 'production'],
config: {
id: ENV['GOOGLE_TAGS_CONTAINER_ID'],
envParams: ENV['GOOGLE_TAGS_PARAMS']
}
})
end

config['gReCaptcha'] ||= {}
if ENV['GOOGLE_RECAPTCHA_SITE_KEY']
config['gReCaptcha']['siteKey'] = ENV['GOOGLE_RECAPTCHA_SITE_KEY']
end

if ENV['TRIAL_DAYS']
config['trialDays'] = ENV['TRIAL_DAYS']
end

if ENV['DISABLE_SENTRY']
config['sentry']['development'] = true
end

config['tempBanner'] ||= {}
config['tempBanner']['tempBannerEnabled'] = ENV['TEMPORARY_ANNOUNCEMENT_BANNER_ENABLED'] || false
config['tempBanner']['tempBannerMessage'] = ENV['TEMPORARY_ANNOUNCEMENT_MESSAGE'] || ''

regexp = %r{<meta name="travis/config/environment"\s+content="([^"]+)"}
string.gsub!(regexp) do
ember_config = JSON.parse(CGI.unescape(::Regexp.last_match(1)))
Expand Down