mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 06:56:44 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
b913f43dde
commit
70393534eb
4 changed files with 36 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.4";
|
||||
import { corsHeaders } from "../_shared/cors.ts";
|
||||
import { authorizeInternalRequest } from "../_shared/internal-auth.ts";
|
||||
import {
|
||||
HERMES_START_COMMAND,
|
||||
createRailwayService,
|
||||
|
|
@ -60,6 +61,13 @@ async function notifyAdmin(message: string): Promise<void> {
|
|||
Deno.serve(async (req) => {
|
||||
if (req.method === "OPTIONS") return new Response(null, { headers: corsHeaders });
|
||||
|
||||
// Auth: aceita X-Internal-Secret (trigger pg_net / chamadas internas) OU JWT de admin.
|
||||
const auth = await authorizeInternalRequest(req, { allowOwner: false });
|
||||
if (!auth.ok) {
|
||||
console.warn(`[provision-agent] auth rejected: ${auth.reason}`);
|
||||
return jsonResponse(401, { error: "unauthorized", reason: auth.reason });
|
||||
}
|
||||
|
||||
if (!RAILWAY_API_TOKEN) {
|
||||
return jsonResponse(500, { error: "RAILWAY_API_TOKEN not configured" });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue