mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
add debug option to SystemSettings. and error page shows stacktrace only for admin or debug settings.
This commit is contained in:
@@ -62,8 +62,9 @@ trait SystemSettingsControllerBase extends AccountManagementControllerBase {
|
||||
"mailAttribute" -> trim(label("Mail address attribute", optional(text()))),
|
||||
"tls" -> trim(label("Enable TLS", optional(boolean()))),
|
||||
"ssl" -> trim(label("Enable SSL", optional(boolean()))),
|
||||
"keystore" -> trim(label("Keystore", optional(text())))
|
||||
)(Ldap.apply))
|
||||
"keystore" -> trim(label("Keystore", optional(text()))),
|
||||
)(Ldap.apply)),
|
||||
"debug" -> trim(label("Debug", boolean()))
|
||||
)(SystemSettings.apply).verifying { settings =>
|
||||
Vector(
|
||||
if(settings.ssh && settings.baseUrl.isEmpty){
|
||||
|
||||
@@ -54,6 +54,7 @@ trait SystemSettingsService {
|
||||
ldap.keystore.foreach(x => props.setProperty(LdapKeystore, x))
|
||||
}
|
||||
}
|
||||
props.setProperty(Debug, settings.debug.toString)
|
||||
using(new java.io.FileOutputStream(GitBucketConf)){ out =>
|
||||
props.store(out, null)
|
||||
}
|
||||
@@ -111,7 +112,8 @@ trait SystemSettingsService {
|
||||
getOptionValue(props, LdapKeystore, None)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
getValue(props, Debug, false)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -136,7 +138,8 @@ object SystemSettingsService {
|
||||
useSMTP: Boolean,
|
||||
smtp: Option[Smtp],
|
||||
ldapAuthentication: Boolean,
|
||||
ldap: Option[Ldap]){
|
||||
ldap: Option[Ldap],
|
||||
debug: Boolean){
|
||||
def baseUrl(request: HttpServletRequest): String = baseUrl.fold(request.baseUrl)(_.stripSuffix("/"))
|
||||
|
||||
def sshAddress:Option[SshAddress] =
|
||||
@@ -219,6 +222,7 @@ object SystemSettingsService {
|
||||
private val LdapTls = "ldap.tls"
|
||||
private val LdapSsl = "ldap.ssl"
|
||||
private val LdapKeystore = "ldap.keystore"
|
||||
private val Debug = "debug"
|
||||
|
||||
private def getValue[A: ClassTag](props: java.util.Properties, key: String, default: A): A = {
|
||||
getSystemProperty(key).getOrElse(getEnvironmentVariable(key).getOrElse {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<div class="content-wrapper main-center">
|
||||
<div class="content body">
|
||||
<h1>@title</h1>
|
||||
@if(context.loginAccount.map{_.isAdmin}.getOrElse(false) || context.settings.debug){
|
||||
@e.map { ex =>
|
||||
<h2>@ex.getMessage</h2>
|
||||
<table class="table table-condensed table-striped table-hover">
|
||||
@@ -13,6 +14,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
} else {
|
||||
<div>Please contact your administrator.</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ class AvatarImageProviderSpec extends FunSpec with MockitoSugar {
|
||||
useSMTP = false,
|
||||
smtp = None,
|
||||
ldapAuthentication = false,
|
||||
ldap = None)
|
||||
ldap = None,
|
||||
debug = false)
|
||||
|
||||
/**
|
||||
* Adapter to test AvatarImageProviderImpl.
|
||||
|
||||
Reference in New Issue
Block a user