Commit 16f3bb72 authored by Liang Ding's avatar Liang Ding

🎨 Fix #12913

parent d84cffd9
......@@ -22,6 +22,7 @@ import org.b3log.latke.Latkes;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.util.Strings;
import org.b3log.solo.util.Markdowns;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Slf4jLog;
......@@ -37,7 +38,7 @@ import java.io.File;
* </ul>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.0, Mar 29, 2019
* @version 1.1.1.1, Sep 22, 2019
* @since 1.2.0
*/
public final class Starter {
......@@ -92,9 +93,14 @@ public final class Starter {
hasArg().desc("runtime mode (DEVELOPMENT/PRODUCTION), default is DEVELOPMENT").build();
options.addOption(runtimeModeOpt);
final Option luteHttpOpt = Option.builder("lute").longOpt("lute_http").argName("LUTE_HTTP").
hasArg().desc("lute http URL, default is http://localhost:8249, see https://github.com/b3log/lute-http for more details").build();
options.addOption(luteHttpOpt);
options.addOption("h", "help", false, "print help for the command");
final HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.setWidth(120);
final CommandLineParser commandLineParser = new DefaultParser();
CommandLine commandLine;
......@@ -158,6 +164,10 @@ public final class Starter {
if (null != runtimeMode) {
Latkes.setRuntimeMode(Latkes.RuntimeMode.valueOf(runtimeMode));
}
String luteHttp = commandLine.getOptionValue("lute");
if (null != luteHttp) {
Markdowns.LUTE_ENGINE_URL = luteHttp;
}
String webappDirLocation = "src/main/webapp/"; // POM structure in dev env
final File file = new File(webappDirLocation);
......
......@@ -101,9 +101,9 @@ public final class Markdowns {
private static final HtmlRenderer RENDERER = HtmlRenderer.builder(OPTIONS).build();
/**
* Lute engine serve path. https://github.com/b3log/lute
* Lute engine serve path. https://github.com/b3log/lute-http
*/
private static final String LUTE_ENGINE_URL = "http://localhost:8249";
public static String LUTE_ENGINE_URL = "http://localhost:8249";
/**
* Whether Lute is available.
......@@ -273,7 +273,7 @@ public final class Markdowns {
final URL url = new URL(LUTE_ENGINE_URL);
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(1000);
conn.setReadTimeout(7000);
conn.setReadTimeout(2000);
conn.setDoOutput(true);
try (final OutputStream outputStream = conn.getOutputStream()) {
......
......@@ -53,7 +53,7 @@ import java.util.ResourceBundle;
* Solo utilities.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.9.0.1, May 9, 2019
* @version 1.9.0.2, Sep 22, 2019
* @since 2.8.0
*/
public final class Solos {
......@@ -102,6 +102,12 @@ public final class Solos {
}
FAVICON_API = solo.getString("faviconAPI");
try {
Markdowns.LUTE_ENGINE_URL = solo.getString("luteHttp")
} catch (final Exception e) {
// ignored
}
}
static {
......
......@@ -18,8 +18,9 @@
#
# Description: Solo configurations.
# Version: 2.5.0.1, Apr 2, 2019
# Version: 2.6.0.0, Sep 22, 2019
# Author: Liang Ding
#
faviconAPI=https://api.byi.pw/favicon?url=
luteHttp=http://localhost:8249
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment