|
|
@@ -61,4 +61,21 @@ Rails.application.configure do
|
|
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
|
|
# routes, locales, etc. This feature depends on the listen gem.
|
|
|
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
|
|
+
|
|
|
+ # Remove web_console warnings when running inside a docker container:
|
|
|
+ # Cannot render console from 172.27.0.1! Allowed networks: 127.0.0.1
|
|
|
+ if File.file?('/.dockerenv')
|
|
|
+ require 'socket'
|
|
|
+ require 'ipaddr'
|
|
|
+
|
|
|
+ # Whitelist docker ip for web console
|
|
|
+ Socket.ip_address_list.each do |addrinfo|
|
|
|
+ next unless addrinfo.ipv4?
|
|
|
+ next if addrinfo.ip_address == '127.0.0.1' # Already whitelisted
|
|
|
+
|
|
|
+ ip = IPAddr.new(addrinfo.ip_address).mask(24)
|
|
|
+ Logger.new(STDOUT).info "Adding #{ip.inspect} to config.web_console.whitelisted_ips"
|
|
|
+ config.web_console.whitelisted_ips << ip
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|