Skip to content

Commit

Permalink
🔊 diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Feb 8, 2024
1 parent bcd1eaa commit 59b4096
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/commonhaus/automation/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.commonhaus.automation;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Path;

import jakarta.enterprise.event.Observes;
Expand All @@ -17,6 +19,17 @@ public class Main {

public static void main(String... args) {
System.out.println("cwd=" + Path.of("").toAbsolutePath());

try {
String hostName = "api.github.com";

// Resolving host name to IP address
InetAddress address = InetAddress.getByName(hostName);
System.out.println("IP address of " + hostName + ": " + address.getHostAddress());
} catch (UnknownHostException e) {
System.out.println("Could not resolve host: " + e.getMessage());
}

Quarkus.run(ApplicationRoot.class, args);
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/commonhaus/automation/Routes.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import jakarta.inject.Inject;

import io.quarkus.logging.Log;
import io.quarkus.qute.Engine;
import io.quarkus.qute.Template;
import io.quarkus.vertx.web.Route;
Expand All @@ -15,13 +16,13 @@ public class Routes {
@Inject
Engine engine;

@Route(path = "/", order = 99)
@Route(path = "/", order = 99, produces = "text/html")
public void handleRequest(RoutingContext routingContext, RoutingExchange routingExchange) throws IOException {
Template tpl = engine.getTemplate("index.html");

Log.infof("handle plain request");
routingExchange
.ok()
.putHeader("X-Robots-Tag", "noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex")
.end(tpl == null ? "alive" : tpl.render());
.end(tpl.render());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static Set<DataLabel> queryLabels(QueryContext queryContext, String label
: JsonAttribute.labels.extractObjectFrom(obj, JsonAttribute.node);
});

Log.infof("queryLabels for labelable %s; result=%s", labels);
Log.infof("queryLabels for labelable %s; result=%s", labeledId, labels);
return labels;
}

Expand Down Expand Up @@ -217,7 +217,7 @@ mutation AddLabels($labelableId: ID!, $labelIds: [ID!]!, $after: String) {
return JsonAttribute.labels.extractObjectFrom(obj, JsonAttribute.addLabelsToLabelable, JsonAttribute.labelable);
});

Log.infof("modifyLabels for labelable %s; result=%s", labels);
Log.infof("modifyLabels for labelable %s; result=%s", labeledId, labels);
return labels;
}

Expand Down

0 comments on commit 59b4096

Please sign in to comment.