Advertisement
Guest User

Untitled

a guest
Sep 30th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. require 'active_record'
  2. require 'dashing'
  3.  
  4. EM::threadpool_size = 20
  5. ActiveRecord::Base.establish_connection(
  6. :adapter => "mysql2",
  7. :host => "10.1.150.24",
  8. :database => "dashboards",
  9. :username => "root",
  10. :password => "xxx",
  11. :encoding => "utf8",
  12. :pool => 20
  13. )
  14.  
  15.  
  16. configure do
  17. set :auth_token, 'xxx'
  18. set :protection, :except => :frame_options
  19.  
  20.  
  21. helpers do
  22. def protected!
  23. # Put any authentication code you want in here.
  24. # This method is run before accessing any resource.
  25. end
  26. end
  27. end
  28.  
  29. map Sinatra::Application.assets_prefix do
  30. run Sinatra::Application.sprockets
  31. end
  32.  
  33. run Sinatra::Application
  34.  
  35. SCHEDULER.every '30m', first_in => 0 do
  36. data = ActiveRecord::Base.connection.execute("SELECT * FROM ......")
  37. ##work with data
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement