Skip to content

Commit

Permalink
added integration and example config
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Cannarella committed Jan 6, 2025
1 parent 83b3883 commit ddd35b0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/config/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"type": {
"type": "string",
"enum": [
"jira"
"jira",
"vm"
]
},
"webhookPath": {
Expand Down Expand Up @@ -143,4 +144,4 @@
}
}
}
}
}
28 changes: 28 additions & 0 deletions internal/config/testdata/config-vm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"integrations": [
{
"source": {
"type": "vm",
"webhookPath": "/vm/webhook",
"authentication": {
"secret": {
"fromFile": "testdata/secret"
}
}
},
"pipelines": [
{
"processors": [],
"sinks": [
{
"type": "fake",
"url": {
"fromEnv": "TEST_LOAD_SERVICE_MONGO_URL"
}
}
]
}
]
}
]
}
10 changes: 10 additions & 0 deletions internal/server/integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/mia-platform/integration-connector-agent/internal/sinks/mongo"
"github.com/mia-platform/integration-connector-agent/internal/sources"
"github.com/mia-platform/integration-connector-agent/internal/sources/jira"
"github.com/mia-platform/integration-connector-agent/internal/sources/vm"
"github.com/mia-platform/integration-connector-agent/internal/sources/webhook"

swagger "github.com/davidebianchi/gswagger"
Expand Down Expand Up @@ -76,6 +77,15 @@ func setupPipelines(ctx context.Context, log *logrus.Logger, cfg *config.Configu
if err := webhook.SetupService(ctx, oasRouter, &jiraConfig.Configuration, pg); err != nil {
return fmt.Errorf("%w: %s", errSetupSource, err)
}
case "vm":
vmConfig, err := config.GetConfig[*vm.Config](cfgIntegration.Source)
if err != nil {
return err
}

if err := webhook.SetupService(ctx, oasRouter, &vmConfig.Configuration, pg); err != nil {
return fmt.Errorf("%w: %s", errSetupSource, err)
}

case "test":
// do nothing only for testing
Expand Down
1 change: 1 addition & 0 deletions internal/sources/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ package sources

const (
Jira = "jira"
VM = "vm"
)

0 comments on commit ddd35b0

Please sign in to comment.