2017-09-08 08:28:34 +00:00
|
|
|
class SettingProxy < ActiveRecord::Migration[4.2]
|
2017-01-16 00:24:56 +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(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Proxy Settings',
|
|
|
|
name: 'proxy',
|
|
|
|
area: 'System::Network',
|
2017-01-16 00:24:56 +00:00
|
|
|
description: 'Address of the proxy server for http and https resources.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-01-16 00:24:56 +00:00
|
|
|
form: [
|
|
|
|
{
|
2018-12-19 17:31:51 +00:00
|
|
|
display: '',
|
|
|
|
null: false,
|
|
|
|
name: 'proxy',
|
|
|
|
tag: 'input',
|
2017-01-16 00:24:56 +00:00
|
|
|
placeholder: 'proxy.example.com:3128',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: '',
|
2017-01-16 00:24:56 +00:00
|
|
|
preferences: {
|
|
|
|
online_service_disable: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
controller: 'SettingsAreaProxy',
|
|
|
|
prio: 1,
|
|
|
|
permission: ['admin.system'],
|
2017-01-16 00:24:56 +00:00
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-01-16 00:24:56 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Proxy User',
|
|
|
|
name: 'proxy_username',
|
|
|
|
area: 'System::Network',
|
2017-01-16 00:24:56 +00:00
|
|
|
description: 'Username for proxy connection.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-01-16 00:24:56 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: false,
|
|
|
|
name: 'proxy_username',
|
|
|
|
tag: 'input',
|
2017-01-16 00:24:56 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: '',
|
2017-01-16 00:24:56 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
disabled: true,
|
2017-01-16 00:24:56 +00:00
|
|
|
online_service_disable: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 2,
|
|
|
|
permission: ['admin.system'],
|
2017-01-16 00:24:56 +00:00
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-01-16 00:24:56 +00:00
|
|
|
)
|
2017-07-27 10:05:54 +00:00
|
|
|
# fix typo
|
|
|
|
setting = Setting.find_by(name: 'proxy_password')
|
|
|
|
if setting
|
|
|
|
setting.options[:form][0][:name] = 'proxy_password'
|
|
|
|
setting.save!
|
|
|
|
else
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Proxy Password',
|
|
|
|
name: 'proxy_password',
|
|
|
|
area: 'System::Network',
|
2017-07-27 10:05:54 +00:00
|
|
|
description: 'Password for proxy connection.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-07-27 10:05:54 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: false,
|
|
|
|
name: 'proxy_password',
|
|
|
|
tag: 'input',
|
2017-07-27 10:05:54 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: '',
|
2017-07-27 10:05:54 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
disabled: true,
|
2017-07-27 10:05:54 +00:00
|
|
|
online_service_disable: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 3,
|
|
|
|
permission: ['admin.system'],
|
2017-07-27 10:05:54 +00:00
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-07-27 10:05:54 +00:00
|
|
|
)
|
|
|
|
end
|
2017-01-16 00:24:56 +00:00
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'No Proxy',
|
|
|
|
name: 'proxy_no',
|
|
|
|
area: 'System::Network',
|
2017-07-27 10:05:54 +00:00
|
|
|
description: 'No proxy for the following hosts.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-01-16 00:24:56 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: false,
|
|
|
|
name: 'proxy_no',
|
|
|
|
tag: 'input',
|
2017-01-16 00:24:56 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 'localhost,127.0.0.0,::1',
|
2017-01-16 00:24:56 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
disabled: true,
|
2017-01-16 00:24:56 +00:00
|
|
|
online_service_disable: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 4,
|
|
|
|
permission: ['admin.system'],
|
2017-01-16 00:24:56 +00:00
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-01-16 00:24:56 +00:00
|
|
|
)
|
|
|
|
end
|
2017-07-27 10:05:54 +00:00
|
|
|
|
2017-01-16 00:24:56 +00:00
|
|
|
end
|