Skip to content

Commit

Permalink
Merge pull request #33 from takkii/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
takkii authored Jan 1, 2025
2 parents 6fba51e + 748844e commit bf231c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DATABASE_USER = "postgres"
DATABASE_PASSWORD = "password"
IPADDRESS_USER = ""
IPADDRESS_WIN = ""
IPADDRESS_WSL = ""
9 changes: 7 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ def validate_ipaddress
nodejs_path = "node" + " " + "#{File.dirname(__FILE__) + '/myipad.js'}"
stdout_js, stderr_js, status_js = Open3.capture3(nodejs_path)
# When the server is running, only a few permissions are granted.
ip_match = ENV['IPADDRESS_USER']
ip_win = ENV['IPADDRESS_WIN ']
ip_wsl = ENV['IPADDRESS_WSL ']

# Development is assumed to be in a local environment.
unless "#{stdout_js}".match( /#{ip_match}/o) || {}[:match]
if "#{stdout_js}".match( /#{ip_win}/o) || {}[:match]
# windows, ip address specification, nothing displayed.
elsif "#{stdout_js}".match( /#{ip_wsl}/o) || {}[:match]
# wsl2, ip address specification, nothing displayed.
else
raise MyError, "An exception was raised on its own. Something other than an IP address was matched. Please review."
end
end
Expand Down

0 comments on commit bf231c5

Please sign in to comment.