flyrain commented on code in PR #3340: URL: https://github.com/apache/polaris/pull/3340#discussion_r2674432446
########## 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: > profile-specific config works in conjunction with the profile-neutral config That's true, and I can confirm that's how it work today. > This might be too much low-level details for end users to think about. This isn't a user-face doc. This is a comment in the source code. I think it should be fine to be here to provide complete view of how it works. > Even if all the code is bundled in the same Quarkus application, Server and Admin could still have distinct shell entry points and distinct application.properties files (each in its own directory). That would be my preference for the tar-based distribution. > Docker images can bundle anything that Polaris developers are ok with. In docker, users will override config via external mechanisms like env. variables. If a config map is used to define application.properties it will be specific to a particular runtime scenario anyway (Server or Admin, but not both). I understand that these particular use cases may not require profile specific config files today. That said, this does not mean the scenarios I mentioned will never occur. Providing clear and explicit messaging still has value in that context. Even if a user never actively uses `External config/application-cli.properties` as a profile specific external config, having a clear understanding of how it works can be important when diagnosing or debugging unexpected behavior. -- 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]
