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


##########
runtime/server/src/main/java/org/apache/polaris/PolarisApplication.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.picocli.runtime.PicocliRunner;
+import io.quarkus.runtime.Quarkus;
+import io.quarkus.runtime.QuarkusApplication;
+import io.quarkus.runtime.annotations.QuarkusMain;
+
+/**
+ * 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 {
+  /**
+   * Main method that detects CLI mode and activates the appropriate Quarkus 
profile.
+   *
+   * <p>Profile Activation: When CLI arguments are present, the "cli" profile 
is activated using
+   * System.setProperty before Quarkus initialization. This must be done via 
system property (not
+   * ConfigUtils.getProfiles().add()) because Quarkus reads the active profile 
during early
+   * bootstrap, before ConfigUtils can affect the configuration.
+   *
+   * <p>Configuration Priority Order: Quarkus loads configuration from 
multiple sources (highest to
+   * lowest priority):
+   *
+   * <ol>
+   *   <li>(400) System properties: -D flags at JVM startup
+   *   <li>(300) Environment variables
+   *   <li>(260) External config/application-cli.properties: Profile-specific 
external config

Review Comment:
   If a user runs both the server and the CLI the same Polaris binary of the 
same location, a shared `application.properties` applies to both use cases. In 
that setup, having a separate `application-cli.properties` still seems useful 
to capture CLI specific configuration that should not affect the server 
behavior. That separation feels reasonable and keeps the shared defaults clean 
while allowing targeted overrides for the CLI. 
   For example, CLI specific configs like the following will be overwritten by 
`application.properties`
   ```
   quarkus.banner.enabled=false
   quarkus.log.level=WARN
   ```
   
   WDYT? 
   
   



-- 
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