adutra commented on code in PR #3340:
URL: https://github.com/apache/polaris/pull/3340#discussion_r2665805981


##########
runtime/server/src/main/java/org/apache/polaris/PolarisApplication.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris;
+
+import io.quarkus.runtime.Quarkus;
+import io.quarkus.runtime.QuarkusApplication;
+import io.quarkus.runtime.annotations.QuarkusMain;
+import jakarta.inject.Inject;
+import org.apache.polaris.admintool.PolarisAdminTool;
+import picocli.CommandLine;
+
+/**
+ * Main entry point for Polaris application. Supports both HTTP server mode 
and CLI admin mode: - No
+ * arguments: Start HTTP server - With arguments: Run CLI commands (bootstrap, 
purge, etc.)
+ */
+@QuarkusMain
+public class PolarisApplication implements QuarkusApplication {

Review Comment:
   I think this could be simplified a bit:
   
   ```java
   @QuarkusMain
   public class PolarisApplication implements QuarkusApplication {
   
     /** Main method that detects CLI mode and activates the appropriate 
Quarkus profile. */
     public static void main(String... args) {
       if (args.length > 0) {
         System.setProperty("quarkus.profile", "cli");
         Quarkus.run(PicocliRunner.class, args);
       } else {
         Quarkus.run(PolarisApplication.class, args);
       }
     }
   
     @Override
     public int run(String... args) {
       Quarkus.waitForExit();
       return 0;
     }
   }
   ```
   
   I confirmed the above works, if you put back the `@TopCommand` annotation in 
`PolarisAdminTool`.



##########
runtime/defaults/src/main/resources/application.properties:
##########
@@ -293,3 +293,15 @@ quarkus.index-dependency.protobuf.artifact-id=protobuf-java
 # force the locale, just in case the system's using another default locale
 quarkus.default-locale=en_US
 
+# ---- CLI Mode Configuration (activated via -Dquarkus.profile=cli) ----

Review Comment:
   Rather than adding properties here, wdyt about introducing a profile-aware 
file `application-cli.properties`? I think this would more clearly demarcate 
the configuration for CLI from the one for server (which is also the default).
   
   https://quarkus.io/guides/config-reference#profile-aware-files



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to