Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ServerConfig
private boolean nestedDataSerializationEnabled = true;
private Duration clusterResourceGroupStateInfoExpirationDuration = new Duration(0, MILLISECONDS);
private String clusterTag;
private boolean webUIEnabled = true;

public boolean isResourceManager()
{
Expand Down Expand Up @@ -116,6 +117,18 @@ public ServerConfig setCoordinator(boolean coordinator)
return this;
}

public boolean isWebUIEnabled()
{
return webUIEnabled;
}

@Config("webui-enabled")
public ServerConfig setWebUIEnabled(boolean webUIEnabled)
{
this.webUIEnabled = webUIEnabled;
return this;
}

@NotNull(message = "presto.version must be provided when it cannot be automatically determined")
public String getPrestoVersion()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void testDefaults()
{
assertRecordedDefaults(ConfigAssertions.recordDefaults(ServerConfig.class)
.setCoordinator(true)
.setWebUIEnabled(true)
.setPrestoVersion(null)
.setDataSources(null)
.setIncludeExceptionInResponse(true)
Expand All @@ -58,6 +59,7 @@ public void testExplicitPropertyMappings()
{
Map<String, String> properties = new ImmutableMap.Builder<String, String>()
.put("coordinator", "false")
.put("webui-enabled", "false")
.put("presto.version", "test")
.put("datasources", "jmx")
.put("http.include-exception-in-response", "false")
Expand All @@ -78,6 +80,7 @@ public void testExplicitPropertyMappings()

ServerConfig expected = new ServerConfig()
.setCoordinator(false)
.setWebUIEnabled(false)
.setPrestoVersion("test")
.setDataSources("jmx")
.setIncludeExceptionInResponse(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ public class CoordinatorModule
"default-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " +
"font-src 'self' https://fonts.gstatic.com; frame-ancestors 'self'; img-src 'self' data:; form-action 'self'";

private final boolean isWebUIEnabled;

public CoordinatorModule(boolean webUIEnabled)
{
this.isWebUIEnabled = webUIEnabled;
}

public static HttpResourceBinding webUIBinder(Binder binder, String path, String classPathResourceBase)
{
return httpServerBinder(binder).bindResource(path, classPathResourceBase)
Expand All @@ -158,9 +165,14 @@ public static HttpResourceBinding webUIBinder(Binder binder, String path, String
@Override
protected void setup(Binder binder)
{
webUIBinder(binder, "/ui/dev", "webapp/dev").withWelcomeFile("index.html");
webUIBinder(binder, "/ui", "webapp").withWelcomeFile("index.html");
webUIBinder(binder, "/tableau", "webapp/tableau");
if (isWebUIEnabled) {
webUIBinder(binder, "/ui/dev", "webapp/dev").withWelcomeFile("index.html");
webUIBinder(binder, "/ui", "webapp").withWelcomeFile("index.html");
webUIBinder(binder, "/tableau", "webapp/tableau");
}
else {
webUIBinder(binder, "/ui", "nowebapp").withWelcomeFile("index.html");
Comment thread
aaneja marked this conversation as resolved.
}

// discovery server
install(installModuleIf(EmbeddedDiscoveryConfig.class, EmbeddedDiscoveryConfig::isEnabled, new EmbeddedDiscoveryModule()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ else if (serverConfig.isCatalogServer()) {
install(new CatalogServerModule());
}
else if (serverConfig.isCoordinator()) {
install(new CoordinatorModule());
install(new CoordinatorModule(serverConfig.isWebUIEnabled()));
Comment thread
aaneja marked this conversation as resolved.
}
else {
install(new WorkerModule());
Expand Down
35 changes: 35 additions & 0 deletions presto-main/src/main/resources/nowebapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Presto UI Disabled</title>
<style>
body {
font-family: sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background: #f7f7f9;
color: #222;
}

main {
text-align: center;
padding: 24px;
}

h1 {
font-size: 1.5rem;
margin: 0;
}
</style>
</head>
<body>
<main>
<h1>The Presto UI has been disabled for this environment</h1>
</main>
</body>
</html>
Loading