mirror of https://github.com/docusealco/docuseal
- Add health_check method to Submissions::UploadToPaperless (GET /api/ with 3s timeout) - Add Rails initializer that logs connection status at boot - Add INFO logging to UploadToPaperlessJob (start, success with doc count/task IDs) - Add paperless-ngx status section to Settings → Notifications page (live connection check with 60s cache, DaisyUI badges: Connected/Unreachable/Not Configured) - Add specs for health_check method (5 scenarios) and system specs (3 scenarios)pull/681/head
parent
d767e8a030
commit
fe87513416
@ -0,0 +1,28 @@
|
|||||||
|
<div class="mt-8 mb-4">
|
||||||
|
<h2 class="text-3xl font-bold mb-4">
|
||||||
|
Paperless-ngx
|
||||||
|
</h2>
|
||||||
|
<div class="flex items-center space-x-3">
|
||||||
|
<% if !@paperless_status[:configured] %>
|
||||||
|
<span class="badge badge-ghost">Not Configured</span>
|
||||||
|
<span class="text-sm opacity-70">
|
||||||
|
Set PAPERLESS_NGX_URL and PAPERLESS_NGX_TOKEN environment variables to enable.
|
||||||
|
</span>
|
||||||
|
<% elsif @paperless_status[:reachable] %>
|
||||||
|
<span class="badge badge-success">Connected</span>
|
||||||
|
<span class="text-sm opacity-70">
|
||||||
|
<%= @paperless_status[:url] %>
|
||||||
|
</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="badge badge-error">Unreachable</span>
|
||||||
|
<span class="text-sm opacity-70">
|
||||||
|
<%= @paperless_status[:url] %> — <%= @paperless_status[:error] %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% if @paperless_status[:configured] %>
|
||||||
|
<p class="text-sm opacity-70 mt-2">
|
||||||
|
Signed documents are automatically uploaded to Paperless-ngx when all parties complete signing.
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
Rails.application.config.after_initialize do
|
||||||
|
status = Submissions::UploadToPaperless.health_check
|
||||||
|
|
||||||
|
if !status[:configured]
|
||||||
|
Rails.logger.info('[Paperless-ngx] Integration not configured (PAPERLESS_NGX_URL / PAPERLESS_NGX_TOKEN not set)')
|
||||||
|
elsif status[:reachable]
|
||||||
|
Rails.logger.info("[Paperless-ngx] Connected to #{status[:url]}")
|
||||||
|
else
|
||||||
|
Rails.logger.warn("[Paperless-ngx] Configured but unreachable at #{status[:url]}: #{status[:error]}")
|
||||||
|
end
|
||||||
|
rescue StandardError => e
|
||||||
|
Rails.logger.warn("[Paperless-ngx] Health check failed during startup: #{e.message}")
|
||||||
|
end
|
||||||
Loading…
Reference in new issue