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

ViteRuby: Add configuration in config/vite.rb for running proxy in custom environments #525

Open
vizo opened this issue Jan 7, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@vizo
Copy link

vizo commented Jan 7, 2025

Is your feature request related to a problem? Please describe.
We use Rails custom environments e.g. staging, unit_test, ...
Since run_proxy? has hardcoded env names and logic, it would be great to make run_proxy? configurable as lambda that returns true/false in config/vite.rb.

Additional context
Source code:

def run_proxy?

For now i had to monkey patch:

    # Public: The proxy for assets should not run in production mode or test mode when env CI is present.
    def run_proxy?
      return false if config.mode == "production"
      return false if config.mode.ends_with?("test") && ENV.fetch("CI", false)

      true
    rescue StandardError => e
      logger.error("Failed to check mode for Vite: #{e.message}")
      false
    end
@vizo vizo changed the title ViteRuby: Add configuration for running proxy in custom environments in config/vite.rb ViteRuby: Add configuration in config/vite.rb for running proxy in custom environments Jan 7, 2025
@ElMassimo ElMassimo added the enhancement New feature or request label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants