From 2bc1a4e5dd82cef6ecf73eb986d0b2b8f579193a Mon Sep 17 00:00:00 2001 From: lburgazzoli Date: Mon, 9 Mar 2020 13:15:50 +0100 Subject: [PATCH] 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 93955c77fb..53cf20a99b 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 }