Skip to content

Commit

Permalink
(maint) use common config implementation for engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tphoney committed Oct 30, 2024
1 parent 17e1e95 commit abae921
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ terraform.tfstate
terraform.tfstate.backup
/tmp/
/node_modules
__debug_bin*
28 changes: 20 additions & 8 deletions cmd/explore.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,19 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
p := pool.NewWithResults[*discovery.Engine]().WithErrors()

p.Go(func() (*discovery.Engine, error) {
ec := discovery.EngineConfig{
Version: fmt.Sprintf("cli-%v", cliVersion),
EngineType: "cli-stdlib",
SourceName: fmt.Sprintf("stdlib-source-%v", hostname),
SourceUUID: uuid.New(),
App: oi.ApiUrl.Host,
ApiKey: token.AccessToken,
MaxParallelExecutions: 2_000,
}
stdlibEngine, err := stdlibSource.InitializeEngine(
&ec,
natsOptions,
fmt.Sprintf("stdlib-source-%v", hostname),
fmt.Sprintf("cli-%v", cliVersion),
uuid.New(),
heartbeatOptions,
2_000,
true,
)
if err != nil {
Expand Down Expand Up @@ -122,14 +128,20 @@ func StartLocalSources(ctx context.Context, oi sdp.OvermindInstance, token *oaut
statusArea.Println("Using default AWS CLI config. No AWS terraform providers found.")
configs = append(configs, userConfig)
}
ec := discovery.EngineConfig{
EngineType: "cli-aws",
Version: fmt.Sprintf("cli-%v", cliVersion),
SourceName: fmt.Sprintf("aws-source-%v", hostname),
SourceUUID: uuid.New(),
App: oi.ApiUrl.Host,
ApiKey: token.AccessToken,
MaxParallelExecutions: 2_000,
}
awsEngine, err := proc.InitializeAwsSourceEngine(
ctx,
fmt.Sprintf("aws-source-%v", hostname),
fmt.Sprintf("cli-%v", cliVersion),
uuid.New(),
&ec,
natsOptions,
heartbeatOptions,
2_000,
1, // Don't retry as we want the user to get notified immediately
configs...,
)
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/muesli/reflow v0.3.0
github.com/muesli/termenv v0.15.3-0.20240912151726-82936c5ea257
github.com/overmindtech/aws-source v0.0.0-20241025011151-44d13fa1e1e0
github.com/overmindtech/discovery v0.29.2
github.com/overmindtech/aws-source v0.0.0-20241030131805-de96f8d7d8fb
github.com/overmindtech/discovery v0.30.0
github.com/overmindtech/k8s-source v0.8.1-0.20241025005632-15223645e039
github.com/overmindtech/pterm v0.0.0-20240919144758-04d94ccb2297
github.com/overmindtech/sdp-go v0.96.0
github.com/overmindtech/stdlib-source v0.0.0-20241018075207-50872fb39aad
github.com/overmindtech/stdlib-source v0.0.0-20241030163048-1250dcbf584a
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/sirupsen/logrus v1.9.3
github.com/sourcegraph/conc v0.3.0
Expand Down Expand Up @@ -128,7 +128,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down Expand Up @@ -175,7 +175,7 @@ require (
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/time v0.7.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
Expand Down Expand Up @@ -300,8 +300,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nats-io/jwt/v2 v2.7.2 h1:SCRjfDLJ2q8naXp8YlGJJS5/yj3wGSODFYVi4nnwVMw=
github.com/nats-io/jwt/v2 v2.7.2/go.mod h1:kB6QUmqHG6Wdrzj0KP2L+OX4xiTPBeV+NHVstFaATXU=
github.com/nats-io/nats-server/v2 v2.10.21 h1:gfG6T06wBdI25XyY2IsauarOc2srWoFxxfsOKjrzoRA=
github.com/nats-io/nats-server/v2 v2.10.21/go.mod h1:I1YxSAEWbXCfy0bthwvNb5X43WwIWMz7gx5ZVPDr5Rc=
github.com/nats-io/nats-server/v2 v2.10.22 h1:Yt63BGu2c3DdMoBZNcR6pjGQwk/asrKU7VX846ibxDA=
github.com/nats-io/nats-server/v2 v2.10.22/go.mod h1:X/m1ye9NYansUXYFrbcDwUi/blHkrgHh2rgCJaakonk=
github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE=
github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
Expand All @@ -314,10 +314,10 @@ github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
github.com/openrdap/rdap v0.9.2-0.20240517203139-eb57b3a8dedd h1:UuQycBx6K0lB0/IfHePshOYjlrptkF4FoApFP2Y4s3k=
github.com/openrdap/rdap v0.9.2-0.20240517203139-eb57b3a8dedd/go.mod h1:391Ww1JbjG4FHOlvQqCd6n25CCCPE64JzC5cCYPxhyM=
github.com/overmindtech/aws-source v0.0.0-20241025011151-44d13fa1e1e0 h1:dE7+ToLG6BGrdcMP38dFumlPX1HSL4NApnX4c2Vub20=
github.com/overmindtech/aws-source v0.0.0-20241025011151-44d13fa1e1e0/go.mod h1:E0VRwYZjelHjMy2tGE5JGlT4BRMiOQC/njoUVk2dTPI=
github.com/overmindtech/discovery v0.29.2 h1:bRCaWG8T9RfgVURwvrP86XMTjXhP5RXXvMKx9FTLYEA=
github.com/overmindtech/discovery v0.29.2/go.mod h1:MUDUqB0vM7xJ9wQdpyNWFPmqtXNjh6QfYhQ4g7QIRmU=
github.com/overmindtech/aws-source v0.0.0-20241030131805-de96f8d7d8fb h1:6t0M63RsvsAHyYrl8Pnu2EL34PQ01v/aqzRN+b4Rhjo=
github.com/overmindtech/aws-source v0.0.0-20241030131805-de96f8d7d8fb/go.mod h1:nznIVTQxMuveB/2i33aEytOUxvjcybBKjyg6XQHoPqY=
github.com/overmindtech/discovery v0.30.0 h1:cZoYfHtLIzYTAtJO0r8+SAmtFdY+RaozD9hhOJ+6gro=
github.com/overmindtech/discovery v0.30.0/go.mod h1:rYAyBHfdvK57fUusO4+Qh/YkKMBvbxv6HYWNo23Dhe8=
github.com/overmindtech/k8s-source v0.8.1-0.20241025005632-15223645e039 h1:0tyTikhvj0WRpcJ1j0XQwnURG13ZowRpRKZ1rD5NRr4=
github.com/overmindtech/k8s-source v0.8.1-0.20241025005632-15223645e039/go.mod h1:8Ptd2eEIgLvOBGbnq0m3C7EB615gTjedk7Idv9x35ws=
github.com/overmindtech/pterm v0.0.0-20240919144758-04d94ccb2297 h1:ih4bqBMHTCtg3lMwJszNkMGO9n7Uoe0WX5be1/x+s+g=
Expand All @@ -326,8 +326,8 @@ github.com/overmindtech/sdp-go v0.96.0 h1:4rgO8VSkS4Kh/Yv8IluFrXD5c7rU2rgACO/xLh
github.com/overmindtech/sdp-go v0.96.0/go.mod h1:6PPU8IBPWeMVXe1UW/LHb/hbwZPR0ndfjHRTbNQJy2w=
github.com/overmindtech/sdpcache v1.6.4 h1:MJoYBDqDE3s8FrRzZ0RPgFiH39HWI/Mv2ImH1NdLT8k=
github.com/overmindtech/sdpcache v1.6.4/go.mod h1:/F9XStVdntRJEQjlZ86BPuB1Y7VPo1PFcsCNiU1IoGE=
github.com/overmindtech/stdlib-source v0.0.0-20241018075207-50872fb39aad h1:t+u+OYAN15hME9skD9MwChPuOM3YyHdmM+ZIbYC8jqg=
github.com/overmindtech/stdlib-source v0.0.0-20241018075207-50872fb39aad/go.mod h1:K/rztWTrn3PEcwnStnnu15neyYKVVj1tpEnB28C8f5o=
github.com/overmindtech/stdlib-source v0.0.0-20241030163048-1250dcbf584a h1:sp/0m6VsA9do/OORiHS8x/arnlNHYWZoXVZbgom36D0=
github.com/overmindtech/stdlib-source v0.0.0-20241030163048-1250dcbf584a/go.mod h1:gEt8xo9RavtqpsVZxmnFMzX6rhNo/V9dvNgvAIIbLwg=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
Expand Down Expand Up @@ -514,8 +514,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down

0 comments on commit abae921

Please sign in to comment.