You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/03/10 17:11:38 UTC

[camel-k] 03/09: Add some sugar to rest APIs #1316 (small cleanup)

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 0c6b43c92cc6fd46d9c275764d9455eceb9e6405
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Mon Mar 9 13:15:50 2020 +0100

    Add some sugar to rest APIs #1316 (small cleanup)
---
 pkg/trait/openapi.go | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/pkg/trait/openapi.go b/pkg/trait/openapi.go
index 93955c7..53cf20a 100644
--- a/pkg/trait/openapi.go
+++ b/pkg/trait/openapi.go
@@ -40,6 +40,15 @@ import (
 	"github.com/apache/camel-k/pkg/util/maven"
 )
 
+// OpenAPITraitName ---
+const OpenAPITraitName = "openapi"
+
+// CamelRestPortProperty ---
+const CamelRestPortProperty = "camel.rest.port"
+
+// CamelRestDefaultPort ---
+const CamelRestDefaultPort = "8080"
+
 // The OpenAPI DSL trait is internally used to allow creating integrations from a OpenAPI specs.
 //
 // +camel-k:trait=openapi
@@ -49,7 +58,7 @@ type openAPITrait struct {
 
 func newOpenAPITrait() Trait {
 	return &openAPITrait{
-		BaseTrait: NewBaseTrait("openapi", 300),
+		BaseTrait: NewBaseTrait(OpenAPITraitName, 300),
 	}
 }
 
@@ -96,7 +105,7 @@ func (t *openAPITrait) Apply(e *Environment) error {
 	}
 
 	if e.IntegrationInPhase(v1.IntegrationPhaseDeploying, v1.IntegrationPhaseRunning) {
-		e.ApplicationProperties["camel.rest.port"] = "8080"
+		e.ApplicationProperties[CamelRestPortProperty] = CamelRestDefaultPort
 		return nil
 	}