mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
SAM_VIEWER=true (set only by the records package's viewer/docker-compose.yml) makes the app a read-only copy of an archive, for whoever receives the records: `docker compose up`, then open http://localhost:3000. - At start (bin/docker-entrypoint → sam:viewer:prepare) the package's .sam.zip, mounted read-only, is imported once. - No sign-in: everyone browses as a built-in account. Nothing can be changed: any request but GET/HEAD is refused, no role permission applies (so no edit buttons), and there's no sign-out or profile. A banner names the archive and when it was exported. - It refuses to start, and every page answers 503, when the database has any other account, so turning it on for a real installation stops the app instead of exposing its records. - The viewer listens on 127.0.0.1 only, and skips scheduled jobs (reminders, backups, AD searches). - Docs: the package README (three steps now), Access & sharing, README settings and features, the suggested recordkeeping procedures. Checked end to end with a built image and a real records package: the archive imported at start, pages browsed without an account, a change refused, and the container refusing to start once an account existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
528 B
Ruby
15 lines
528 B
Ruby
# Viewer mode (SAM_VIEWER=true, see Viewer): checks the database has no real
|
|
# accounts and imports SAM_VIEWER_ARCHIVE the first time. bin/docker-entrypoint
|
|
# runs it before the server starts.
|
|
namespace :sam do
|
|
namespace :viewer do
|
|
desc "Viewer mode: check the database and import the archive"
|
|
task prepare: :environment do
|
|
abort "SAM_VIEWER isn't on." unless Viewer.enabled?
|
|
Viewer.prepare!
|
|
rescue Viewer::RealAccounts, AircraftArchive::Error => e
|
|
abort "Viewer: #{e.message}"
|
|
end
|
|
end
|
|
end
|