Skip to content

Commit

Permalink
Add some sugar to rest APIs apache#1316 (small cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Mar 9, 2020
1 parent 42f4b53 commit 2bc1a4e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/trait/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,7 +58,7 @@ type openAPITrait struct {

func newOpenAPITrait() Trait {
return &openAPITrait{
BaseTrait: NewBaseTrait("openapi", 300),
BaseTrait: NewBaseTrait(OpenAPITraitName, 300),
}
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 2bc1a4e

Please sign in to comment.