diff options
Diffstat (limited to 'config/initializers/static_files.rb')
-rw-r--r-- | config/initializers/static_files.rb | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb index e02f0868e9f..4e19fec084a 100644 --- a/config/initializers/static_files.rb +++ b/config/initializers/static_files.rb @@ -15,32 +15,14 @@ if app.config.public_file_server.enabled # If webpack-dev-server is configured, proxy webpack's public directory # instead of looking for static assets - dev_server = Gitlab.config.webpack.dev_server - - if dev_server.enabled - settings = { - enabled: true, - host: dev_server.host, - port: dev_server.port, - manifest_host: dev_server.host, - manifest_port: dev_server.port - } - - if Rails.env.development? - settings.merge!( - host: Gitlab.config.gitlab.host, - port: Gitlab.config.gitlab.port, - https: false - ) - app.config.middleware.insert_before( - Gitlab::Middleware::Static, - Gitlab::Webpack::DevServerMiddleware, - proxy_path: app.config.webpack.public_path, - proxy_host: dev_server.host, - proxy_port: dev_server.port - ) - end - - app.config.webpack.dev_server.merge!(settings) + if Gitlab.config.webpack.dev_server.enabled && Rails.env.development? + app.config.middleware.insert_before( + Gitlab::Middleware::Static, + Gitlab::Webpack::DevServerMiddleware, + proxy_path: Gitlab.config.webpack.public_path, + proxy_host: Gitlab.config.webpack.dev_server.host, + proxy_port: Gitlab.config.webpack.dev_server.port, + proxy_https: Gitlab.config.webpack.dev_server.https + ) end end |