Change configuration keys

This commit is contained in:
Naoki Takezoe
2018-07-30 10:34:38 +09:00
parent 04823666b6
commit 4cb04e9cc3
5 changed files with 23 additions and 23 deletions

View File

@@ -255,7 +255,7 @@ object PluginRegistry {
}) })
.foreach(_.delete()) .foreach(_.delete())
withHttpClient(settings.proxy) { httpClient => withHttpClient(settings.pluginProxy) { httpClient =>
val httpGet = new HttpGet(url.toString) val httpGet = new HttpGet(url.toString)
try { try {
val response = httpClient.execute(httpGet) val response = httpClient.execute(httpGet)

View File

@@ -21,7 +21,7 @@ object PluginRepository {
try { try {
val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json") val url = new java.net.URL("https://plugins.gitbucket-community.org/releases/plugins.json")
withHttpClient(context.settings.proxy) { httpClient => withHttpClient(context.settings.pluginProxy) { httpClient =>
val httpGet = new HttpGet(url.toString) val httpGet = new HttpGet(url.toString)
try { try {
val response = httpClient.execute(httpGet) val response = httpClient.execute(httpGet)

View File

@@ -70,14 +70,14 @@ trait SystemSettingsService {
props.setProperty(SkinName, settings.skinName.toString) props.setProperty(SkinName, settings.skinName.toString)
props.setProperty(ShowMailAddress, settings.showMailAddress.toString) props.setProperty(ShowMailAddress, settings.showMailAddress.toString)
props.setProperty(PluginNetworkInstall, settings.pluginNetworkInstall.toString) props.setProperty(PluginNetworkInstall, settings.pluginNetworkInstall.toString)
settings.proxy.foreach { proxy => settings.pluginProxy.foreach { proxy =>
props.setProperty(ProxyHost, proxy.host) props.setProperty(PluginProxyHost, proxy.host)
props.setProperty(ProxyPort, proxy.port.toString) props.setProperty(PluginProxyPort, proxy.port.toString)
proxy.user.foreach { user => proxy.user.foreach { user =>
props.setProperty(ProxyUser, user) props.setProperty(PluginProxyUser, user)
} }
proxy.password.foreach { password => proxy.password.foreach { password =>
props.setProperty(ProxyPassword, password) props.setProperty(PluginProxyPassword, password)
} }
} }
@@ -158,13 +158,13 @@ trait SystemSettingsService {
getValue(props, SkinName, "skin-blue"), getValue(props, SkinName, "skin-blue"),
getValue(props, ShowMailAddress, false), getValue(props, ShowMailAddress, false),
getValue(props, PluginNetworkInstall, false), getValue(props, PluginNetworkInstall, false),
if (getValue(props, ProxyHost, "").nonEmpty) { if (getValue(props, PluginProxyHost, "").nonEmpty) {
Some( Some(
Proxy( Proxy(
getValue(props, ProxyHost, ""), getValue(props, PluginProxyHost, ""),
getValue(props, ProxyPort, 8080), getValue(props, PluginProxyPort, 8080),
getOptionValue(props, ProxyUser, None), getOptionValue(props, PluginProxyUser, None),
getOptionValue(props, ProxyPassword, None) getOptionValue(props, PluginProxyPassword, None)
) )
) )
} else None } else None
@@ -198,7 +198,7 @@ object SystemSettingsService {
skinName: String, skinName: String,
showMailAddress: Boolean, showMailAddress: Boolean,
pluginNetworkInstall: Boolean, pluginNetworkInstall: Boolean,
proxy: Option[Proxy] pluginProxy: Option[Proxy]
) { ) {
def baseUrl(request: HttpServletRequest): String = def baseUrl(request: HttpServletRequest): String =
@@ -322,10 +322,10 @@ object SystemSettingsService {
private val SkinName = "skinName" private val SkinName = "skinName"
private val ShowMailAddress = "showMailAddress" private val ShowMailAddress = "showMailAddress"
private val PluginNetworkInstall = "plugin.networkInstall" private val PluginNetworkInstall = "plugin.networkInstall"
private val ProxyHost = "proxy.host" private val PluginProxyHost = "plugin.proxy.host"
private val ProxyPort = "proxy.port" private val PluginProxyPort = "plugin.proxy.port"
private val ProxyUser = "proxy.user" private val PluginProxyUser = "plugin.proxy.user"
private val ProxyPassword = "proxy.password" private val PluginProxyPassword = "plugin.proxy.password"
private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = { private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = {
getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse { getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse {

View File

@@ -9,7 +9,7 @@
<hr> <hr>
<fieldset> <fieldset>
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" id="useProxy" name="useProxy"@if(context.settings.proxy.isDefined){ checked} /> <input type="checkbox" id="useProxy" name="useProxy"@if(context.settings.pluginProxy.isDefined){ checked} />
Use proxy Use proxy
</label> </label>
</fieldset> </fieldset>
@@ -17,28 +17,28 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-2" for="proxyHost">Proxy host</label> <label class="control-label col-md-2" for="proxyHost">Proxy host</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" id="proxyHost" name="proxy.host" class="form-control" value="@context.settings.proxy.map(_.host)"/> <input type="text" id="proxyHost" name="proxy.host" class="form-control" value="@context.settings.pluginProxy.map(_.host)"/>
<span id="error-proxy_host" class="error"></span> <span id="error-proxy_host" class="error"></span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-2" for="proxyPort">Proxy port</label> <label class="control-label col-md-2" for="proxyPort">Proxy port</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" id="proxyPort" name="proxy.port" class="form-control input-mini" value="@context.settings.proxy.map(_.port)"/> <input type="text" id="proxyPort" name="proxy.port" class="form-control input-mini" value="@context.settings.pluginProxy.map(_.port)"/>
<span id="error-proxy_port" class="error"></span> <span id="error-proxy_port" class="error"></span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-2" for="proxyUser">Proxy user</label> <label class="control-label col-md-2" for="proxyUser">Proxy user</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" id="proxyUser" name="proxy.user" class="form-control" value="@context.settings.proxy.map(_.user)"/> <input type="text" id="proxyUser" name="proxy.user" class="form-control" value="@context.settings.pluginProxy.map(_.user)"/>
<span id="error-proxy_user" class="error"></span> <span id="error-proxy_user" class="error"></span>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-2" for="proxyPassword">Proxy password</label> <label class="control-label col-md-2" for="proxyPassword">Proxy password</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" id="proxyPassword" name="proxy.password" class="form-control" value="@context.settings.proxy.map(_.password)"/> <input type="text" id="proxyPassword" name="proxy.password" class="form-control" value="@context.settings.pluginProxy.map(_.password)"/>
<span id="error-proxy_password" class="error"></span> <span id="error-proxy_password" class="error"></span>
</div> </div>
</div> </div>

View File

@@ -139,7 +139,7 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
skinName = "skin-blue", skinName = "skin-blue",
showMailAddress = false, showMailAddress = false,
pluginNetworkInstall = false, pluginNetworkInstall = false,
proxy = None pluginProxy = None
) )
/** /**