jordigilh commented on code in PR #311:
URL: 
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/311#discussion_r1426124264


##########
controllers/profiles/common/properties/application.go:
##########
@@ -143,31 +131,18 @@ func (a *appPropertyHandler) Build() string {
 func (a *appPropertyHandler) withKogitoServiceUrl() AppPropertyHandler {
        var kogitoServiceUrl string
        if len(a.workflow.Namespace) > 0 {
-               kogitoServiceUrl = fmt.Sprintf("%s://%s.%s", 
kogitoServiceUrlProtocol, a.workflow.Name, a.workflow.Namespace)
+               kogitoServiceUrl = fmt.Sprintf("%s://%s.%s", 
constants.KogitoServiceUrlProtocol, a.workflow.Name, a.workflow.Namespace)
        } else {
-               kogitoServiceUrl = fmt.Sprintf("%s://%s", 
kogitoServiceUrlProtocol, a.workflow.Name)
+               kogitoServiceUrl = fmt.Sprintf("%s://%s", 
constants.KogitoServiceUrlProtocol, a.workflow.Name)
        }
-       return a.addDefaultMutableProperty(kogitoServiceUrlProperty, 
kogitoServiceUrl)
-}
-
-// withDataIndexServiceUrl adds the property dataIndexServiceUrlProperty to 
the application properties.
-// See Service Discovery 
https://kubernetes.io/docs/concepts/services-networking/service/#dns
-func (a *appPropertyHandler) withDataIndexServiceUrl() AppPropertyHandler {
-       if profiles.IsProdProfile(a.workflow) && dataIndexEnabled(a.platform) {

Review Comment:
   Done to check if the workflow does not contain the `Dev` profile instead of 
checking if it has the `Prod` profile



##########
controllers/platform/services/properties.go:
##########
@@ -0,0 +1,131 @@
+// Copyright 2023 Apache Software Foundation (ASF)
+//
+// Licensed 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 services
+
+import (
+       "fmt"
+       "net/url"
+       "strings"
+
+       operatorapi 
"github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08"
+       
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common/constants"
+
+       "github.com/magiconair/properties"
+)
+
+func generateReactiveURL(postgresSpec *operatorapi.PersistencePostgreSql, 
schema string, namespace string, dbName string, port int) (string, error) {
+       if len(postgresSpec.JdbcUrl) > 0 {
+               s := strings.TrimLeft(postgresSpec.JdbcUrl, "jdbc:")
+               u, err := url.Parse(s)
+               if err != nil {
+                       return "", err
+               }
+               ret := fmt.Sprintf("%s://", u.Scheme)
+               if len(u.User.Username()) > 0 {
+                       p, ok := u.User.Password()
+                       if ok {
+                               ret = fmt.Sprintf("%s%s:%s@", ret, 
u.User.Username(), p)
+                       }
+               }
+               ret = fmt.Sprintf("%s%s%s?", ret, u.Host, u.Path)
+               kv, err := url.ParseQuery(u.RawQuery)
+               if err != nil {
+                       return "", err
+               }
+               spv := schema
+               if v, ok := kv["search_path"]; ok {
+                       for _, val := range v {
+                               if len(val) != 0 {
+                                       spv = v[0]
+                               }
+                       }
+               } else if v, ok := kv["currentSchema"]; ok {
+                       for _, val := range v {
+                               if len(val) != 0 {
+                                       spv = v[0]
+                               }
+                       }
+               }
+               return fmt.Sprintf("%ssearch_path=%s", ret, spv), nil

Review Comment:
   Done. PTAL



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to