mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
* Add PostHog * Queue Posthog *after* adding to DB * Update app/services/posthog_service.rb Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add /api/v1/banned_users/counts --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
11 lines
314 B
Ruby
11 lines
314 B
Ruby
require "posthog"
|
|
|
|
if ENV["POSTHOG_API_KEY"].present?
|
|
$posthog = PostHog::Client.new({
|
|
api_key: ENV["POSTHOG_API_KEY"],
|
|
host: ENV.fetch("POSTHOG_HOST", "https://us.i.posthog.com"),
|
|
on_error: proc { |status, msg| Rails.logger.error "PostHog error: #{status} - #{msg}" }
|
|
})
|
|
else
|
|
$posthog = nil
|
|
end
|