Created
September 1, 2011 17:52
-
-
Save guillaumerose/1186773 to your computer and use it in GitHub Desktop.
DHCP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Backend | |
class DHCP < Sinatra::Base | |
get '/options' do | |
content_type "application/json" | |
ordinateur = Ordinateur.where(:mac => params["mac"].try(:gsub, ":", "-")).limit(1).first | |
return '{}' if ordinateur.nil? || ordinateur.desactive? | |
ordinateur.vu! | |
'{"options" : "fixed-address ' + ordinateur.ip + ';"}' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment