20161122000001_monitoring_issue_453.rb 850 B

12345678910111213141516171819202122232425262728293031323334353637
  1. class MonitoringIssue453 < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. Setting.create_if_not_exists(
  6. title: 'Monitoring Token',
  7. name: 'monitoring_token',
  8. area: 'HealthCheck::Base',
  9. description: 'Token for Monitoring.',
  10. options: {
  11. form: [
  12. {
  13. display: '',
  14. null: false,
  15. name: 'monitoring_token',
  16. tag: 'input',
  17. },
  18. ],
  19. },
  20. state: SecureRandom.urlsafe_base64(40),
  21. preferences: {
  22. permission: ['admin.monitoring'],
  23. },
  24. frontend: false,
  25. )
  26. Permission.create_if_not_exists(
  27. name: 'admin.monitoring',
  28. note: 'Manage %s',
  29. preferences: {
  30. translations: ['Monitoring']
  31. },
  32. )
  33. end
  34. end