Files
gsc-shell-api/seeds/001_gsc-crm.sql
Claude 7fb24e0452 feat: gsc-shell-api v0.1 — central chrome data API
Tiny Go service that returns ShellConfig JSON for any registered app.
Backs the runtime-loaded <AppShell> component being added to
@limitless/ui (next).

Endpoints:
  GET /api/v1/shell/{appKey}  → app + branding + user + menus, ETag-cached
  GET /api/v1/apps            → registered app inventory
  GET /healthz, /readyz       → ops probes

Auth:
  Keycloak Bearer JWT validated against the gosecCloud realm.
  Discovery URL is overridable so pods can hit Keycloak via the
  in-cluster service (https://keycloak.keycloak.svc.cluster.local:8443)
  while still validating the canonical issuer (auth.gosec.cloud).
  Lazy JWKS init — pod stays up if Keycloak is briefly unreachable.

Data model (gsc_core.shell):
  apps · menu_items (zone enum: topbar/sidebar/footer/user-menu) ·
  menu_role_grants (Keycloak realm roles, OR semantics, empty=all) ·
  branding

Seed includes the 8 gsc-crm sidebar items + topbar search +
user-menu (settings/support/logout) + footer (docs).

K8s:
  Namespace gsc-shell (ambient mesh).
  Deployment 2 replicas, internal-only ingress shell-api.gosec.internal,
  EJBCA SERVER cert.
  ServiceEntry for auth.gosec.cloud (vestigial — discovery now uses
  in-cluster path; keeping for ad-hoc curl from inside pods).
  Added to keycloak/allow-keycloak-clients AuthorizationPolicy out of band.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 20:10:22 +02:00

73 lines
3.6 KiB
SQL

-- gsc-shell-api — seed for the gsc-crm app.
-- Idempotent via ON CONFLICT.
INSERT INTO shell.apps (app_key, display_name, base_url) VALUES
('gsc-crm', 'GSC CRM', 'https://crm.gosec.internal')
ON CONFLICT (app_key) DO UPDATE
SET display_name = EXCLUDED.display_name,
base_url = EXCLUDED.base_url;
INSERT INTO shell.branding (app_key, logo_url, product_name, footer_html, brand_color) VALUES
(
'gsc-crm',
'https://assets.gosec.cloud/logos/logo.svg',
'CRM',
'© GoSec Cloud',
NULL
)
ON CONFLICT (app_key) DO UPDATE
SET logo_url = EXCLUDED.logo_url,
product_name = EXCLUDED.product_name,
footer_html = EXCLUDED.footer_html,
brand_color = EXCLUDED.brand_color;
-- Sidebar items.
INSERT INTO shell.menu_items (app_key, zone, key, translation_key, href, icon, sort_order) VALUES
('gsc-crm', 'sidebar', 'dashboard', 'menu.dashboard', '/dashboard', 'ph-house', 10),
('gsc-crm', 'sidebar', 'accounts', 'menu.accounts', '/accounts', 'ph-buildings', 20),
('gsc-crm', 'sidebar', 'contacts', 'menu.contacts', '/contacts', 'ph-users', 30),
('gsc-crm', 'sidebar', 'leads', 'menu.leads', '/leads', 'ph-target', 40),
('gsc-crm', 'sidebar', 'opportunities', 'menu.opportunities', '/opportunities', 'ph-currency-dollar', 50),
('gsc-crm', 'sidebar', 'pipelines', 'menu.pipelines', '/pipelines', 'ph-kanban', 60),
('gsc-crm', 'sidebar', 'activities', 'menu.activities', '/activities', 'ph-list-checks', 70),
('gsc-crm', 'sidebar', 'reports', 'menu.reports', '/reports', 'ph-chart-bar', 80)
ON CONFLICT (app_key, zone, key) DO UPDATE
SET translation_key = EXCLUDED.translation_key,
href = EXCLUDED.href,
icon = EXCLUDED.icon,
sort_order = EXCLUDED.sort_order,
is_active = true;
-- Top bar (just the user-facing search hint for now).
INSERT INTO shell.menu_items (app_key, zone, key, translation_key, href, icon, sort_order) VALUES
('gsc-crm', 'topbar', 'search', 'menu.search', '/search', 'ph-magnifying-glass', 10)
ON CONFLICT (app_key, zone, key) DO UPDATE
SET translation_key = EXCLUDED.translation_key,
href = EXCLUDED.href,
icon = EXCLUDED.icon,
sort_order = EXCLUDED.sort_order,
is_active = true;
-- User menu (top-right dropdown). Sign-out + settings + support.
INSERT INTO shell.menu_items (app_key, zone, key, translation_key, href, icon, sort_order, is_external) VALUES
('gsc-crm', 'user-menu', 'settings', 'menu.settings', '/settings', 'ph-gear', 10, false),
('gsc-crm', 'user-menu', 'support', 'menu.support', 'https://support.gosec.cloud/', 'ph-headset', 20, true),
('gsc-crm', 'user-menu', 'logout', 'menu.logout', '/api/auth/signout', 'ph-sign-out',30, false)
ON CONFLICT (app_key, zone, key) DO UPDATE
SET translation_key = EXCLUDED.translation_key,
href = EXCLUDED.href,
icon = EXCLUDED.icon,
sort_order = EXCLUDED.sort_order,
is_external = EXCLUDED.is_external,
is_active = true;
-- Footer items.
INSERT INTO shell.menu_items (app_key, zone, key, translation_key, href, icon, sort_order, is_external) VALUES
('gsc-crm', 'footer', 'docs', 'footer.docs', 'https://docs.gosec.cloud/', NULL, 10, true)
ON CONFLICT (app_key, zone, key) DO UPDATE
SET translation_key = EXCLUDED.translation_key,
href = EXCLUDED.href,
sort_order = EXCLUDED.sort_order,
is_external = EXCLUDED.is_external,
is_active = true;