Skip to content

Instantly share code, notes, and snippets.

@guillaumerose
Created September 1, 2011 17:52
Show Gist options
  • Save guillaumerose/1186773 to your computer and use it in GitHub Desktop.
Save guillaumerose/1186773 to your computer and use it in GitHub Desktop.
DHCP
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