astefanutti commented on a change in pull request #2858:
URL: https://github.com/apache/camel-k/pull/2858#discussion_r783092522
##########
File path: pkg/trait/jvm.go
##########
@@ -169,6 +171,59 @@ func (t *jvmTrait) Apply(e *Environment) error {
args = append(args, t.Options...)
}
+ // Translate HTTP proxy environment variables, that are set by the
environment trait,
+ // into corresponding JVM system properties.
+ if HTTPProxy := envvar.Get(container.Env, "HTTP_PROXY"); HTTPProxy !=
nil {
+ u, err := url.Parse(HTTPProxy.Value)
+ if err != nil {
+ return err
+ }
+ if !util.StringSliceContainsAnyOf(t.Options, "http.proxyHost") {
+ args = append(args, fmt.Sprintf("-Dhttp.proxyHost=%q",
u.Hostname()))
+ }
+ if port := u.Port(); !util.StringSliceContainsAnyOf(t.Options,
"http.proxyPort") && port != "" {
+ args = append(args, fmt.Sprintf("-Dhttp.proxyPort=%q",
u.Port()))
+ }
+ if user := u.User; !util.StringSliceContainsAnyOf(t.Options,
"http.proxyUser") && user != nil {
+ args = append(args, fmt.Sprintf("-Dhttp.proxyUser=%q",
user.Username()))
+ if password, ok := user.Password();
!util.StringSliceContainsAnyOf(t.Options, "http.proxyUser") && ok {
+ args = append(args,
fmt.Sprintf("-Dhttp.proxyPassword=%q", password))
+ }
+ }
+ }
+
+ if HTTPSProxy := envvar.Get(container.Env, "HTTPS_PROXY"); HTTPSProxy
!= nil {
Review comment:
Sure, let's do this in a subsequent PR so as to have this one in the
upcoming release.
##########
File path: pkg/util/maven/maven_proxies.go
##########
@@ -0,0 +1,89 @@
+/*
+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 maven
+
+import (
+ "net/url"
+ "os"
+ "strings"
+)
+
+var ProxyFromEnvironment = proxyFromEnvironment{}
+
+type proxyFromEnvironment struct{}
+
+func (proxyFromEnvironment) apply(settings *Settings) error {
+ if httpProxy := os.Getenv("HTTP_PROXY"); httpProxy != "" {
+ proxy, err := parseProxyFromEnvVar(httpProxy)
+ if err != nil {
+ return err
+ }
+ proxy.ID = "http-proxy"
+ settings.Proxies = append(settings.Proxies, proxy)
+ }
+
+ if httpsProxy := os.Getenv("HTTPS_PROXY"); httpsProxy != "" {
Review comment:
Sure, let's do this in a subsequent PR so as to have this one in the
upcoming release.
##########
File path: resources/traits.yaml
##########
@@ -810,22 +815,28 @@ traits:
- Knative
- OpenShift
description: 'The Mount trait can be used to configure volumes mounted on
the Integration
- Pod. nolint: tagliatelle'
+ Pods. nolint: tagliatelle'
Review comment:
It's already rebased, but it's not fixing it locally.
--
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]