Also cleanup some documentation *Database Settings have been renamed and will require manually fixing from 6.2beta1* database.varchar.maxlength -> DatabaseMysqlMaxlength database.config.type -> DatabaseConfigType database.config.embed.driver -> DatabasigEmbedDriver database.config.embed.url -> DatabaseConfigEmbedUrl database.config.embed.username -> DatabasigEmbedUsername database.config.embed.password -> DatabasigEmbedPassword database.config.jndi.name -> DatabaseConfigJNDIName database.usertable.quote -> DatabaseUsertableQuote Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>master
parent
9b35781b87
commit
9c224b7853
@ -0,0 +1,40 @@ |
|||||||
|
# Startup Configuration Guide |
||||||
|
|
||||||
|
Libresonic has some system-wide configuration. These configurations are stored in the |
||||||
|
`libresonic.properties` file. There is one exception, which is the `libresonic.home` parameter which |
||||||
|
is supplied as a Java System Property. |
||||||
|
|
||||||
|
## `libresonic.properties` |
||||||
|
These parameters are simple key-value pairs stored in a list. It is recommended that these parameters |
||||||
|
are changed through the web interface settings page. However, they can also be modified directly. Shutdown |
||||||
|
your server first, modify, then start it for changes to take effect. |
||||||
|
|
||||||
|
## Java Parameters |
||||||
|
The `libresonic.home` parameter is a Java System Property that is not modifiable through the web interface. |
||||||
|
It must be configured via Java startup parameters. See below for steps to do this. |
||||||
|
|
||||||
|
#### `libresonic.home` |
||||||
|
This parameter dictates the folder where Libresonic will store its logs, |
||||||
|
settings, transcode binaries, index and database if using the default H2 |
||||||
|
database. As such it is recommended to backup this folder. |
||||||
|
|
||||||
|
*default: `/var/libresonic` or `C:\\music`* |
||||||
|
|
||||||
|
#### Setting Java Parameters on Tomcat |
||||||
|
As described in the [RUNNING.txt](http://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt) doc provided by tomcat, |
||||||
|
you can create a file named `setenv.sh` or for windows `setenv.bat` in the Tomcat home `bin` folder to modify the |
||||||
|
java args. |
||||||
|
|
||||||
|
Here is an example of a `setenv.sh` file (`setenv.bat` has slightly different syntax): |
||||||
|
``` |
||||||
|
export JAVA_OPTS="$JAVA_OPTS -Dlibresonic.home=/home/andrew/.cache/libresonic-test" |
||||||
|
``` |
||||||
|
|
||||||
|
#### Setting Java Parameters for Standalone Package (SpringBoot) |
||||||
|
When running the standalone package, add `-Dlibresonic.home=YOUR_PATH_HERE` to the `java` command line right before the |
||||||
|
`-jar` argument. Here is an example for linux (windows users will want to use their OS specific path syntax i.e. |
||||||
|
`C:\\your\path`) |
||||||
|
|
||||||
|
``` |
||||||
|
java -Dlibresonic.home=/home/andrew/libresonichome -jar libresonic.war |
||||||
|
``` |
@ -0,0 +1,82 @@ |
|||||||
|
package org.libresonic.player.command; |
||||||
|
|
||||||
|
import org.libresonic.player.spring.DataSourceConfigType; |
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull; |
||||||
|
|
||||||
|
public class DatabaseSettingsCommand { |
||||||
|
|
||||||
|
@NotNull |
||||||
|
private DataSourceConfigType configType; |
||||||
|
private String embedDriver; |
||||||
|
private String embedPassword; |
||||||
|
private String embedUrl; |
||||||
|
private String embedUsername; |
||||||
|
private String JNDIName; |
||||||
|
private int mysqlVarcharMaxlength; |
||||||
|
private String usertableQuote; |
||||||
|
|
||||||
|
public DataSourceConfigType getConfigType() { |
||||||
|
return configType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setConfigType(DataSourceConfigType configType) { |
||||||
|
this.configType = configType; |
||||||
|
} |
||||||
|
|
||||||
|
public String getEmbedDriver() { |
||||||
|
return embedDriver; |
||||||
|
} |
||||||
|
|
||||||
|
public void setEmbedDriver(String embedDriver) { |
||||||
|
this.embedDriver = embedDriver; |
||||||
|
} |
||||||
|
|
||||||
|
public String getEmbedPassword() { |
||||||
|
return embedPassword; |
||||||
|
} |
||||||
|
|
||||||
|
public void setEmbedPassword(String embedPassword) { |
||||||
|
this.embedPassword = embedPassword; |
||||||
|
} |
||||||
|
|
||||||
|
public String getEmbedUrl() { |
||||||
|
return embedUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public void setEmbedUrl(String embedUrl) { |
||||||
|
this.embedUrl = embedUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public String getEmbedUsername() { |
||||||
|
return embedUsername; |
||||||
|
} |
||||||
|
|
||||||
|
public void setEmbedUsername(String embedUsername) { |
||||||
|
this.embedUsername = embedUsername; |
||||||
|
} |
||||||
|
|
||||||
|
public String getJNDIName() { |
||||||
|
return JNDIName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setJNDIName(String JNDIName) { |
||||||
|
this.JNDIName = JNDIName; |
||||||
|
} |
||||||
|
|
||||||
|
public int getMysqlVarcharMaxlength() { |
||||||
|
return mysqlVarcharMaxlength; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMysqlVarcharMaxlength(int mysqlVarcharMaxlength) { |
||||||
|
this.mysqlVarcharMaxlength = mysqlVarcharMaxlength; |
||||||
|
} |
||||||
|
|
||||||
|
public String getUsertableQuote() { |
||||||
|
return usertableQuote; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUsertableQuote(String usertableQuote) { |
||||||
|
this.usertableQuote = usertableQuote; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,106 @@ |
|||||||
|
/* |
||||||
|
This file is part of Libresonic. |
||||||
|
|
||||||
|
Libresonic is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
Libresonic is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Copyright 2016 (C) Libresonic Authors |
||||||
|
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus |
||||||
|
*/ |
||||||
|
package org.libresonic.player.controller; |
||||||
|
|
||||||
|
import org.libresonic.player.command.DatabaseSettingsCommand; |
||||||
|
import org.libresonic.player.dao.AlbumDao; |
||||||
|
import org.libresonic.player.dao.ArtistDao; |
||||||
|
import org.libresonic.player.dao.MediaFileDao; |
||||||
|
import org.libresonic.player.service.MediaScannerService; |
||||||
|
import org.libresonic.player.service.SettingsService; |
||||||
|
import org.libresonic.player.spring.DataSourceConfigType; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.ui.Model; |
||||||
|
import org.springframework.validation.BindingResult; |
||||||
|
import org.springframework.validation.annotation.Validated; |
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping("/databaseSettings") |
||||||
|
public class DatabaseSettingsController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private SettingsService settingsService; |
||||||
|
@Autowired |
||||||
|
private MediaScannerService mediaScannerService; |
||||||
|
@Autowired |
||||||
|
private ArtistDao artistDao; |
||||||
|
@Autowired |
||||||
|
private AlbumDao albumDao; |
||||||
|
@Autowired |
||||||
|
private MediaFileDao mediaFileDao; |
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET) |
||||||
|
protected String displayForm() throws Exception { |
||||||
|
return "databaseSettings"; |
||||||
|
} |
||||||
|
|
||||||
|
@ModelAttribute |
||||||
|
protected void formBackingObject(Model model) throws Exception { |
||||||
|
DatabaseSettingsCommand command = new DatabaseSettingsCommand(); |
||||||
|
command.setConfigType(settingsService.getDatabaseConfigType()); |
||||||
|
command.setEmbedDriver(settingsService.getDatabaseConfigEmbedDriver()); |
||||||
|
command.setEmbedPassword(settingsService.getDatabaseConfigEmbedPassword()); |
||||||
|
command.setEmbedUrl(settingsService.getDatabaseConfigEmbedUrl()); |
||||||
|
command.setEmbedUsername(settingsService.getDatabaseConfigEmbedUsername()); |
||||||
|
command.setJNDIName(settingsService.getDatabaseConfigJNDIName()); |
||||||
|
command.setMysqlVarcharMaxlength(settingsService.getDatabaseMysqlVarcharMaxlength()); |
||||||
|
command.setUsertableQuote(settingsService.getDatabaseUsertableQuote()); |
||||||
|
model.addAttribute("command", command); |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST) |
||||||
|
protected String onSubmit(@ModelAttribute("command") @Validated DatabaseSettingsCommand command, |
||||||
|
BindingResult bindingResult, |
||||||
|
RedirectAttributes redirectAttributes) throws Exception { |
||||||
|
if (!bindingResult.hasErrors()) { |
||||||
|
settingsService.resetDatabaseToDefault(); |
||||||
|
settingsService.setDatabaseConfigType(command.getConfigType()); |
||||||
|
switch(command.getConfigType()) { |
||||||
|
case EMBED: |
||||||
|
settingsService.setDatabaseConfigEmbedDriver(command.getEmbedDriver()); |
||||||
|
settingsService.setDatabaseConfigEmbedPassword(command.getEmbedPassword()); |
||||||
|
settingsService.setDatabaseConfigEmbedUrl(command.getEmbedUrl()); |
||||||
|
settingsService.setDatabaseConfigEmbedUsername(command.getEmbedUsername()); |
||||||
|
break; |
||||||
|
case JNDI: |
||||||
|
settingsService.setDatabaseConfigJNDIName(command.getJNDIName()); |
||||||
|
break; |
||||||
|
case LEGACY: |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
if(command.getConfigType() != DataSourceConfigType.LEGACY) { |
||||||
|
settingsService.setDatabaseMysqlVarcharMaxlength(command.getMysqlVarcharMaxlength()); |
||||||
|
settingsService.setDatabaseUsertableQuote(command.getUsertableQuote()); |
||||||
|
} |
||||||
|
redirectAttributes.addFlashAttribute("settings_toast", true); |
||||||
|
settingsService.save(); |
||||||
|
return "redirect:databaseSettings.view"; |
||||||
|
} else { |
||||||
|
return "databaseSettings.view"; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,128 @@ |
|||||||
|
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="iso-8859-1" %> |
||||||
|
<%--@elvariable id="command" type="org.libresonic.player.command.DatabaseSettingsCommand"--%> |
||||||
|
|
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<%@ include file="head.jsp" %> |
||||||
|
<%@ include file="jquery.jsp" %> |
||||||
|
<script> |
||||||
|
function updateShownOptions() { |
||||||
|
$(".hideawayDatabaseOptions").hide(); |
||||||
|
var value = $('select#configType').val(); |
||||||
|
var objToShow = $("#" + value + "DatabaseOptions"); |
||||||
|
if (objToShow.length) { |
||||||
|
objToShow.show(); |
||||||
|
} |
||||||
|
if(value != 'LEGACY') { |
||||||
|
$("#nonLEGACYDatabaseOptions").show(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$(document).ready(function () { |
||||||
|
updateShownOptions(); |
||||||
|
$('select#configType').on('change', function () { |
||||||
|
updateShownOptions(); |
||||||
|
}); |
||||||
|
}); |
||||||
|
</script> |
||||||
|
</head> |
||||||
|
<body class="mainframe bgcolor1"> |
||||||
|
<script type="text/javascript" src="<c:url value="/script/wz_tooltip.js"/>"></script> |
||||||
|
<script type="text/javascript" src="<c:url value="/script/tip_balloon.js"/>"></script> |
||||||
|
|
||||||
|
<c:import url="settingsHeader.jsp"> |
||||||
|
<c:param name="cat" value="database"/> |
||||||
|
<c:param name="toast" value="${settings_toast}"/> |
||||||
|
</c:import> |
||||||
|
|
||||||
|
<form:form commandName="command" action="databaseSettings.view" method="post"> |
||||||
|
<p><fmt:message key="databasesettings.moreinfo"/></p> |
||||||
|
|
||||||
|
<table style="white-space:nowrap" class="indent"> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.configtype"/></td> |
||||||
|
<td> |
||||||
|
<form:select path="configType" cssStyle="width:12em" id="configType"> |
||||||
|
<form:option value="LEGACY" label="Legacy"/> |
||||||
|
<form:option value="EMBED" label="Embedded JDBC"/> |
||||||
|
<form:option value="JNDI" label="JNDI"/> |
||||||
|
</form:select> |
||||||
|
<c:import url="helpToolTip.jsp"><c:param name="topic" value="databaseConfigType"/></c:import> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
|
||||||
|
<div id="EMBEDDatabaseOptions" class="hideawayDatabaseOptions"> |
||||||
|
<table style="white-space:nowrap;" class="indent"> |
||||||
|
<table style="white-space:nowrap;" class="indent"> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.embeddriver"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="embedDriver" size="30"/> |
||||||
|
<c:import url="helpToolTip.jsp"><c:param name="topic" value="embeddriver"/></c:import> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.embedurl"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="embedUrl" size="58"/> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.embedusername"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="embedUsername" size="36"/> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.embedpassword"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="embedPassword" size="36"/> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div id="JNDIDatabaseOptions" class="hideawayDatabaseOptions"> |
||||||
|
<table style="white-space:nowrap;" class="indent"> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.jndiname"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="JNDIName" size="36"/> |
||||||
|
<c:import url="helpToolTip.jsp"><c:param name="topic" value="jndiname"/></c:import> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
<div id="nonLEGACYDatabaseOptions" class="hideawayDatabaseOptions"> |
||||||
|
<table style="white-space:nowrap" class="indent"> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.mysqlvarcharmaxlength"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="mysqlVarcharMaxlength" size="8"/> |
||||||
|
<c:import url="helpToolTip.jsp"><c:param name="topic" value="mysqlvarcharmaxlength"/></c:import> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td><fmt:message key="databasesettings.usertablequote"/></td> |
||||||
|
<td> |
||||||
|
<form:input path="usertableQuote" size="1" htmlEscape="true"/> |
||||||
|
<c:import url="helpToolTip.jsp"><c:param name="topic" value="usertablequote"/></c:import> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
<p class="warning"><fmt:message key="databasesettings.jdbclibrary"/></p> |
||||||
|
</div> |
||||||
|
|
||||||
|
<p class="warning"><fmt:message key="databasettings.restartRequired"/></p> |
||||||
|
|
||||||
|
<p> |
||||||
|
<input type="submit" value="<fmt:message key="common.save"/>" style="margin-right:0.3em"> |
||||||
|
<input type="button" value="<fmt:message key="common.cancel"/>" onclick="location.href='nowPlaying.view'"> |
||||||
|
</p> |
||||||
|
|
||||||
|
</form:form> |
||||||
|
|
||||||
|
</body> |
||||||
|
</html> |
Loading…
Reference in new issue