Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local emulator #422

Merged
merged 45 commits into from
Feb 13, 2025
Merged

Local emulator #422

merged 45 commits into from
Feb 13, 2025

Conversation

fomalhautb
Copy link
Contributor

@fomalhautb fomalhautb commented Feb 8, 2025

image

Important

Introduces a local emulator setup for Stack with Docker configurations, environment variable handling improvements, and ESLint rule updates.

  • Local Emulator Setup:
    • Added docker/emulator/docker.compose.yaml for local emulator services including Stack Auth Server, Mock OAuth Server, PostgreSQL, Inbucket, and Svix.
    • Added docker/mock-oauth-server/Dockerfile to build the mock OAuth server.
    • Added docker/emulator/inbucket-nginx.conf for Inbucket proxy configuration.
  • Environment Variables:
    • Introduced getPublicEnvVar() in packages/stack-shared/src/utils/env.tsx for accessing public environment variables.
    • Replaced direct process.env access with getPublicEnvVar() in multiple files including sentry.client.config.ts and stack.tsx.
  • ESLint Rules:
    • Added no-next-public-env rule in eslint-configs/extra-rules.js to enforce using getPublicEnvVar().
    • Applied new ESLint rule in .eslintrc.cjs files across the project.
  • Mock OAuth Server:
    • Renamed apps/oauth-mock-server to apps/mock-oauth-server.
    • Updated package.json and index.ts in mock-oauth-server to reflect changes.
  • Miscellaneous:
    • Updated e2e-api-tests.yaml to use new Docker Compose paths.
    • Removed src/lib/env.tsx in dashboard and replaced its functionality with shared utilities.

This description was created by Ellipsis for 5103b88. It will automatically update as commits are pushed.

Copy link

vercel bot commented Feb 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stack-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:54pm
stack-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:54pm
stack-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:54pm

apps/backend/prisma/seed.ts Show resolved Hide resolved
apps/backend/prisma/seed.ts Show resolved Hide resolved
docker/test/Dockerfile Outdated Show resolved Hide resolved
find /app/apps -type f -exec sed -i "s/$escaped_key/$escaped_value/g" {} +

# Replace the sentinel with the value
find /app/apps -type f -exec sed -i "s/$escaped_sentinel/$escaped_value/g" {} +
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed substitution uses '/' as a delimiter but the replacement string (escaped_value) may contain forward slashes. Consider using an alternate delimiter (e.g., |) or also escaping '/' to avoid substitution errors.

Suggested change
find /app/apps -type f -exec sed -i "s/$escaped_sentinel/$escaped_value/g" {} +
find /app/apps -type f -exec sed -i "s|$escaped_sentinel|$escaped_value|g" {} +

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep this is potentially pretty severe. I don't think | protects enough against malicious actors still, but idk what does

docker/server/entrypoint.sh Show resolved Hide resolved
Copy link
Contributor

@N2D4 N2D4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create a new PR with these fixes, and also the fixes from earlier, and then add me as a reviewer?

apps/backend/prisma/seed.ts Show resolved Hide resolved
{getPublicEnvVar('NEXT_PUBLIC_STACK_EMULATOR_ENABLED') === 'true' ? (
<SettingCard
title="Mock Emails"
description="All the emails that are sent in the emulator will land here"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "the" in "All the emails"

find /app/apps -type f -exec sed -i "s/$escaped_key/$escaped_value/g" {} +

# Replace the sentinel with the value
find /app/apps -type f -exec sed -i "s/$escaped_sentinel/$escaped_value/g" {} +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep this is potentially pretty severe. I don't think | protects enough against malicious actors still, but idk what does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants