mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* chore(devcontainer): optimize Dockerfile for Ruby dev environment * chore(devcontainer): update container name and improve VSCode settings - Rename devcontainer from 'Maybe' to 'Sure' - Add GIT_EDITOR env var for VSCode integration - Add Shopify Ruby extensions pack * feat(devcontainer): add custom Bash prompt with Git info - Implement Git branch, status markers in prompt - Show username, current dir, and Git info with colors - Mount custom .bashrc into container for prompt enhancements * fix(devcontainer): improve branch detection & status markers in prompt - Support detached HEAD by showing short SHA - Show detailed git states: rebase, merge, bisect, am - Fix prompt formatting and trailing colors * Better solution to GitHub Codespaces CSRF issue * feat(devcontainer): add Git autocompletion support in bashrc * refactor(devcontainer): reorder volumes and service settings - Added volume mounts for workspace & bundle cache to worker service. --------- Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
26 lines
1.2 KiB
Ruby
26 lines
1.2 KiB
Ruby
# Dev-only adjustments for GitHub Codespaces
|
|
if Rails.env.development? && ENV["CODESPACES"] == "true"
|
|
# Example: forwarded URLs like https://<repo>-<user>-<port>.app.github.dev
|
|
forwarding_domain = ENV["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"] # typically "app.github.dev"
|
|
|
|
# Append allowed hosts ONLY if Host Authorization is enabled (config.hosts is an Array).
|
|
# If it's nil, Host Authorization is disabled and we leave it alone.
|
|
if Rails.application.config.hosts.is_a?(Array)
|
|
if forwarding_domain.present?
|
|
Rails.application.config.hosts << /\A.*\.#{Regexp.escape(forwarding_domain)}\z/
|
|
end
|
|
# Older/alternative preview domain
|
|
Rails.application.config.hosts << /\A.*\.githubpreview\.dev\z/
|
|
end
|
|
|
|
# If you use the VS Code "Preview" (iframe), you need SameSite=None; Secure
|
|
# Codespaces serves over HTTPS, so secure: true is OK here.
|
|
Rails.application.config.session_store :cookie_store,
|
|
key: "_app_session",
|
|
same_site: :none,
|
|
secure: true
|
|
|
|
# Behind the proxy, Origin can differ; relax the origin check instead of disabling CSRF entirely.
|
|
Rails.application.config.action_controller.forgery_protection_origin_check = false
|
|
end
|