feat(UI): update .env file and action for new staging environment#1295
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the configuration to support a new staging environment by simplifying environment-based URL handling and adding new environment configurations. The changes remove production/development conditionals in favor of environment variable-based configuration and add support for both standard staging and a new staging-nju environment.
Key changes:
- Simplifies URL configuration by removing production/development conditionals and relying on environment variables
- Adds new staging environment files for both standard and NJU-specific configurations
- Updates Docker build and deployment workflow to support multiple environment builds
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| moon/packages/config/src/index.ts | Removes production/development URL conditionals and simplifies to environment variable-based configuration |
| moon/apps/web/utils/queryClient.ts | Updates import to use renamed MONO_API_URL constant |
| moon/apps/web/next.config.js | Adds new staging environment URLs to CSP configuration |
| moon/apps/web/components/CodeView/TreeView/CloneTabs.tsx | Updates to use renamed MONO_API_URL constant |
| moon/apps/web/Dockerfile | Adds APP_ENV build argument and copies environment-specific .env files |
| moon/apps/web/.env.staging-nju | Adds new staging environment configuration for NJU deployment |
| moon/apps/web/.env.staging | Adds standard staging environment configuration |
| .github/workflows/web-deploy.yml | Updates workflow to build multiple environment-specific Docker images |
Comments suppressed due to low confidence (1)
moon/packages/config/src/index.ts:19
- [nitpick] The variable name MONO_API_URL is inconsistent with the naming pattern. Consider renaming to LEGACY_API_URL to maintain consistency with the original variable name and avoid confusion, since this appears to be replacing LEGACY_API_URL functionality.
export const MONO_API_URL = process.env.NEXT_PUBLIC_MONO_API_URL || 'https://git.gitmega.com'
|
|
||
| COPY --from=builder /app/out/full/ . | ||
|
|
||
| RUN cp /app/apps/web/.env.${APP_ENV} /app/apps/web/.env.production |
There was a problem hiding this comment.
The copy command will fail if the source file doesn't exist. For example, if APP_ENV is set to a value that doesn't have a corresponding .env file, the build will fail. Consider adding a check to ensure the source file exists before copying, or provide a fallback mechanism.
| RUN cp /app/apps/web/.env.${APP_ENV} /app/apps/web/.env.production | |
| RUN if [ -f /app/apps/web/.env.${APP_ENV} ]; then \ | |
| cp /app/apps/web/.env.${APP_ENV} /app/apps/web/.env.production; \ | |
| else \ | |
| cp /app/apps/web/.env.default /app/apps/web/.env.production; \ | |
| fi |
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Force ECS redeploy |
There was a problem hiding this comment.
The ECS redeploy step in the deploy job will fail because it references variables (REGISTRY, REGISTRY_ALIAS, REPOSITORY, IMAGE_TAG) that are only defined in the build job's matrix strategy. These variables need to be passed to the deploy job or redefined in the deploy job context.
No description provided.