Skip to content

Conversation

atyrode
Copy link
Contributor

@atyrode atyrode commented Apr 29, 2025

This addresses an issue where we had no way to read from the .env and pass a value to the built frontend.
This workaround creates a file at container runtime that will provide non-confidential environment variables to the frontend, that it can then use in turn, to match the user specific config.

This is also a fix for #51 which didn't work properly as the frontend didn't have access to the variables it needed.

atyrode added 6 commits April 29, 2025 21:18
- Modified AuthGate component to retrieve Coder URL from environment variable instead of hardcoding.
- Added new CODER_URL definition in env.d.ts for better configuration management.
- Updated vite.config.mts to load environment variables based on the current mode, allowing for better configuration management.
- Made CODER_URL available through import.meta.env for improved flexibility in accessing environment-specific settings.
- Changed the environment variable reference in AuthGate from VITE_CODER_URL to CODER_URL for consistency with the updated configuration management.
…itialization

- Modified Dockerfile to copy and execute a new startup script instead of directly running the application.
- Introduced startup.sh to create a runtime configuration file with environment variables and start the application.
- Updated index.html to include the new runtime configuration script.
- Enhanced AuthGate component to utilize the runtime configuration for the Coder URL, providing fallback to environment variables.
- Added global TypeScript definitions for the runtime configuration interface.
…ence

- Changed the directory for the runtime configuration file from /config to /assets in startup.sh.
- Updated index.html to reference the new location of the runtime configuration script.
@atyrode atyrode merged commit f02d21b into main Apr 29, 2025
1 check passed
@atyrode atyrode deleted the authgate-hardcoded-fix branch April 29, 2025 22:15
@atyrode atyrode mentioned this pull request Apr 29, 2025
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.

1 participant