horsteff commented on a change in pull request #7533:
URL: https://github.com/apache/pulsar/pull/7533#discussion_r456791792



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneBuilder.java
##########
@@ -97,10 +108,31 @@ public PulsarStandaloneBuilder 
withAdvertisedAddress(String advertisedAddress) {
         return this;
     }
 
-    public PulsarStandalone build() {
-        ServiceConfiguration config = new ServiceConfiguration();
-        config.setClusterName("standalone");
-        pulsarStandalone.setConfig(config);
+    public PulsarStandalone build()
+    {
+        // Change IOException and ConfigurationException into a 
RuntimeException, because if the
+        // config file isn't readable, there is nothing a caller can do, so 
don't bother with
+        // a checked exception that needs to be catched
+        try {
+            // By reading the configuration file here, the user can modify the 
configurations before
+            // calling PulsarStandalone.start()
+            ServerConfiguration bkServerConf = new ServerConfiguration();
+            bkServerConf.loadConf(new 
File(pulsarStandalone.getConfigFile()).toURI().toURL());
+            pulsarStandalone.setBkServerConfig(bkServerConf);
+
+            pulsarStandalone.setConfig(PulsarConfigurationLoader.create(
+                    new FileInputStream(pulsarStandalone.getConfigFile()), 
ServiceConfiguration.class));
+        }
+        catch (IOException | ConfigurationException e) {

Review comment:
       Done.




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

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


Reply via email to