2017-09-08 08:28:34 +00:00
|
|
|
class MonitoringIssue453 < ActiveRecord::Migration[4.2]
|
2016-11-23 14:25:44 +00:00
|
|
|
def up
|
|
|
|
# return if it's a new setup
|
|
|
|
return if !Setting.find_by(name: 'system_init_done')
|
|
|
|
|
|
|
|
Setting.create_if_not_exists(
|
|
|
|
title: 'Monitoring Token',
|
|
|
|
name: 'monitoring_token',
|
|
|
|
area: 'HealthCheck::Base',
|
|
|
|
description: 'Token for Monitoring.',
|
|
|
|
options: {
|
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
|
|
|
null: false,
|
|
|
|
name: 'monitoring_token',
|
|
|
|
tag: 'input',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
state: SecureRandom.urlsafe_base64(40),
|
|
|
|
preferences: {
|
|
|
|
permission: ['admin.monitoring'],
|
|
|
|
},
|
|
|
|
frontend: false,
|
|
|
|
)
|
|
|
|
|
|
|
|
Permission.create_if_not_exists(
|
|
|
|
name: 'admin.monitoring',
|
|
|
|
note: 'Manage %s',
|
|
|
|
preferences: {
|
|
|
|
translations: ['Monitoring']
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|