From a19a0843106c639f3a830233c0f9d396caa86984 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Tue, 17 Jun 2025 09:25:38 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/e2e/bin/seed-db.ts | 9 +++++++-- apps/e2e/src/env.ts | 6 ++++++ apps/web/src/components/header/index.tsx | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/e2e/bin/seed-db.ts b/apps/e2e/bin/seed-db.ts index df6bfb0d..d9cbed6b 100644 --- a/apps/e2e/bin/seed-db.ts +++ b/apps/e2e/bin/seed-db.ts @@ -1,21 +1,26 @@ import { AgenticApiClient } from '@agentic/platform-api-client' import { deployFixtures } from '../src/deploy-fixtures' -import { env } from '../src/env' +import { env, isProd } from '../src/env' export const client = new AgenticApiClient({ apiBaseUrl: env.AGENTIC_API_BASE_URL }) async function main() { + // TODO: clear existing tables? and include prompt to double check if so... + const devAuthSession = await client.signUpWithPassword({ username: 'dev', email: env.AGENTIC_DEV_EMAIL, password: env.AGENTIC_DEV_PASSWORD }) - console.log(JSON.stringify(devAuthSession, null, 2)) + console.warn( + `\n\nREMEMBER TO UPDATE "AGENTIC_DEV_ACCESS_TOKEN" in e2e/.env${isProd ? '.production' : ''}\n\n` + ) + const deployments = await deployFixtures() console.log(JSON.stringify(deployments, null, 2)) } diff --git a/apps/e2e/src/env.ts b/apps/e2e/src/env.ts index 5acd7e90..54e663cb 100644 --- a/apps/e2e/src/env.ts +++ b/apps/e2e/src/env.ts @@ -8,6 +8,10 @@ import { z } from 'zod' // TODO: use `@agentic/platform-hono` base env like other services export const envSchema = z.object({ + ENVIRONMENT: z + .enum(['development', 'test', 'production']) + .default('development'), + AGENTIC_API_BASE_URL: z.string().url().optional(), AGENTIC_DEV_ACCESS_TOKEN: z.string().nonempty(), @@ -25,3 +29,5 @@ export const envSchema = z.object({ export const env = parseZodSchema(envSchema, process.env, { error: 'Invalid environment variables' }) + +export const isProd = env.ENVIRONMENT === 'production' diff --git a/apps/web/src/components/header/index.tsx b/apps/web/src/components/header/index.tsx index 8035d696..da58be81 100644 --- a/apps/web/src/components/header/index.tsx +++ b/apps/web/src/components/header/index.tsx @@ -21,7 +21,7 @@ export function Header() { About - {ctx?.api.isAuthenticated ? ( + {ctx?.isAuthenticated ? ( <> Dashboard