mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 12:34:12 +00:00
PostHog support (#313)
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
# policy.img_src :self, :https, :data
|
||||
# policy.object_src :none
|
||||
# policy.script_src :self, :https
|
||||
# policy.script_src :self, :https, 'https://us.i.posthog.com'
|
||||
# policy.style_src :self, :https
|
||||
# # Specify URI for violation reports
|
||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||
|
||||
14
config/initializers/posthog.rb
Normal file
14
config/initializers/posthog.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require "posthog"
|
||||
|
||||
Rails.configuration.x.posthog = ActiveSupport::OrderedOptions.new
|
||||
Rails.configuration.x.posthog.api_key = ENV["POSTHOG_KEY"].presence
|
||||
Rails.configuration.x.posthog.host = ENV.fetch("POSTHOG_HOST", "https://us.i.posthog.com")
|
||||
|
||||
if (api_key = Rails.configuration.x.posthog.api_key).present?
|
||||
# Initialize PostHog client
|
||||
$posthog = PostHog::Client.new({
|
||||
api_key: api_key,
|
||||
host: Rails.configuration.x.posthog.host,
|
||||
on_error: Proc.new { |status, msg| puts "PostHog error: #{status} - #{msg}" }
|
||||
})
|
||||
end
|
||||
Reference in New Issue
Block a user