screentinker/.env.example
ScreenTinker 674a34ba45 feat(config): HIDE_BILLING flag to hide the Subscription/billing UI (#116)
Opt-in, default-off UI gate (per strobe's spec; verified his file refs first).
When set, hides the Subscription sidebar item + billing view and bounces
#/billing to the dashboard. Billing shown by default -> existing deployments
unchanged. UI-only: /api/subscription/* untouched (internal usage reads stay).

- config.js: config.hideBilling from HIDE_BILLING (mirrors selfHosted).
- auth.js: surface hide_billing on GET /api/auth/me (client already fetches it
  at boot, stored on the user object).
- index.html: id="billingNavItem" on the Subscription <li> (mirrors adminNavItem).
- app.js: toggle billingNavItem in updateSidebarUser (next to the admin toggle);
  guard #/billing -> history.replaceState('#/') + render dashboard (replaceState
  so the back button doesn't loop into the guard).
- .env.example + README documented.

Spec assumptions verified against code: adminNavItem toggle pattern exists;
/me is fetched at boot and updateSidebarUser runs both at boot (cached user)
and post-/me, so no-flash holds on warm loads (one-time flash possible on the
first load after the flag flips — same as the admin nav, minor); route dispatch
is an if/else chain. Nav label is static (no data-i18n) so no i18n change.

Validated (headless Chrome, both states):
- flag unset -> Subscription tab present, #/billing renders (backward-compat).
- HIDE_BILLING=true -> tab hidden, #/billing redirects to #/.
- config maps HIDE_BILLING both ways; live /me default hide_billing=false.
- 149 server tests green. Default-off = zero change for existing deployments.

Known cosmetic (harmless): after the redirect the billing nav LINK keeps its
'active' class, but the nav item is display:none so it's never visible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 09:19:24 -05:00

54 lines
2.7 KiB
Plaintext

# ScreenTinker server configuration — process environment variables.
#
# NOTE: the app reads these from the *process environment* (your systemd unit's
# Environment=/EnvironmentFile=, your container runtime, or your shell). It does
# NOT auto-load this file. Copy the values you need into your process manager.
# This file exists only to document the available options.
# --- Self-hosting ---
# Set to "true" on your own instance. When true, the hosted signup emails
# (welcome to the user + admin notification) are disabled, so a self-hosted
# instance never emits mail from a domain that isn't yours.
SELF_HOSTED=true
# Hide the Subscription/billing UI (nav item + pricing cards) and bounce #/billing to
# the dashboard. Opt-in; default off (billing shown). For instances that bill customers
# externally and don't sell plans through the app. UI-only — does not change SELF_HOSTED
# or disable any /api/subscription endpoints.
HIDE_BILLING=true
# Close public self-service registration — for instances where all accounts are
# provisioned by your team (admin "Add user" / invites). When true, the public
# signup route is blocked (OAuth auto-signup with it) AND the login page hides
# its "Create account" button so the UI matches the backend. First-user setup on
# an empty DB is still allowed so a fresh install can be initialized.
# DISABLE_REGISTRATION=true
# Redirect "/" to the app (/app) instead of serving the marketing landing page.
# For internal-only deployments that don't want the public homepage shown.
# DISABLE_HOMEPAGE=true
# Where new-signup admin notifications are sent. Leave UNSET to disable admin
# notifications entirely — the user's welcome email is unaffected. Self-hosters
# who want to be notified of signups set this to their own address.
# ADMIN_NOTIFY_EMAIL=you@example.com
# Marks THIS deployment as the hosted (screentinker.com) instance. Gates the
# daily activation-nudge sweep (the T+3 "haven't paired a screen yet?" email).
# Leave UNSET on self-hosted instances so a daily bulk sweep never emails your
# user base with our onboarding mail. Only the hosted instance sets this true.
# HOSTED_INSTANCE=true
# --- Outbound email (Microsoft Graph, client-credentials flow) ---
# Required for ANY email (welcome, offline alerts, admin notify) to actually
# send. Leave blank and the app logs "[EMAIL] not configured" instead of sending.
# GRAPH_TENANT_ID=
# GRAPH_CLIENT_ID=
# GRAPH_CLIENT_SECRET=
# GRAPH_SENDER_EMAIL=signage@example.com
# GRAPH_SENDER_NAME=ScreenTinker
# Dev safety net: comma-separated allow-list of recipients. When set, mail to
# any address NOT in the list is suppressed (logged, not sent). Leave UNSET in
# production. Useful locally so test signups can't email real users.
# GRAPH_DEV_RESTRICT_TO=me@example.com