* Adapt dev env to run on a remote box * webpack-dev-server ignores CLI arguments, so switched to environment variables. * Dynamically determine remote webpack host via APP_DOMAIN environment variable, defined in application.yml. * Setup content security policy to allow connecting to webpack on a remote box, defined by APP_DOMAIN environment variable. * Make Webpacker listen on 0.0.0.0 * Account for APP_DOMAIN port * Add support for URI scheme and tests * Fix a spec by disabling a Rubocop linter
15 lines
336 B
Ruby
15 lines
336 B
Ruby
ENVied.require(*ENV["ENVIED_GROUPS"] || Rails.groups)
|
|
|
|
class ApplicationConfig
|
|
URI_REGEXP = %r{(?<scheme>https?://)?(?<host>.+?)(?<port>:\d+)?$}.freeze
|
|
|
|
def self.[](key)
|
|
ENVied.send(key)
|
|
end
|
|
|
|
def self.app_domain_no_port
|
|
app_domain = self["APP_DOMAIN"]
|
|
match = app_domain.match(URI_REGEXP)
|
|
match[:host]
|
|
end
|
|
end
|