Skip to content

Commit 227b860

Browse files
🧹 Expose built in providers.
Signed-off-by: Preslav <preslav@mondoo.com>
1 parent 8b6941c commit 227b860

File tree

6 files changed

+8
-9
lines changed

6 files changed

+8
-9
lines changed

docs/providers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ The current provider scaffolding is geared towards golang. Contributions to exte
288288

289289
If you prefer not to have separate provider binaries that are spawned, it is possible to build any MQL runtime with Go-based providers directly into the binary. This means that no additional files are installed, or update, nor processes spawned.
290290

291-
To manually configure builtin providers, you can modify the list of [`builtinProviders`](https://github.com/mondoohq/mql/blob/main/providers/builtin.go). Once added, you will see it in the list of builtin providers for any binary you build, for example:
291+
To manually configure builtin providers, you can modify the list of [`BuiltinProviders`](https://github.com/mondoohq/mql/blob/main/providers/builtin.go). Once added, you will see it in the list of builtin providers for any binary you build, for example:
292292

293293
```bash
294294
> cnquery providers

providers-sdk/v1/util/configure/configure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func genBuiltinGo(conf ProvidersConf) ([]byte, error) {
164164
provider.Name, trimProvider)
165165

166166
configs += fmt.Sprintf(`
167-
builtinProviders[%sconf.Config.ID] = &builtinProvider{
167+
BuiltinProviders[%sconf.Config.ID] = &builtinProvider{
168168
Runtime: &RunningProvider{
169169
Name: %sconf.Config.Name,
170170
ID: %sconf.Config.ID,
@@ -201,7 +201,7 @@ import (
201201
%s
202202
203203
func init() {
204-
// builtinProviders[osconf.Config.ID] = &builtinProvider{
204+
// BuiltinProviders[osconf.Config.ID] = &builtinProvider{
205205
// Runtime: &RunningProvider{
206206
// Name: osconf.Config.Name,
207207
// ID: osconf.Config.ID,

providers/builtin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
//go:embed core/resources/core.resources.json
2222
var coreInfo []byte
2323

24-
var builtinProviders = map[string]*builtinProvider{
24+
var BuiltinProviders = map[string]*builtinProvider{
2525
coreconf.Config.ID: {
2626
Runtime: &RunningProvider{
2727
Name: coreconf.Config.Name,

providers/builtin_dev.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// var osInfo []byte
1717

1818
func init() {
19-
// builtinProviders[osconf.Config.ID] = &builtinProvider{
19+
// BuiltinProviders[osconf.Config.ID] = &builtinProvider{
2020
// Runtime: &RunningProvider{
2121
// Name: osconf.Config.Name,
2222
// ID: osconf.Config.ID,
@@ -26,5 +26,4 @@ func init() {
2626
// },
2727
// Config: &osconf.Config,
2828
// }
29-
3029
}

providers/coordinator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (c *coordinator) GetRunningProvider(id string, update UpdateProvidersConfig
261261
// unsafeStartProvider will start a provider and add it to the list of running providers. Must be called
262262
// with a mutex lock around it.
263263
func (c *coordinator) unsafeStartProvider(id string, update UpdateProvidersConfig) (*RunningProvider, error) {
264-
if x, ok := builtinProviders[id]; ok {
264+
if x, ok := BuiltinProviders[id]; ok {
265265
// We don't warn for core providers, which are the only providers
266266
// built into the binary (for now).
267267
if id != BuiltinCoreID && id != mockProvider.ID && id != sbomProvider.ID && id != recordingProviderInstance.ID {
@@ -419,7 +419,7 @@ func (c *coordinator) Schema() resources.ResourcesSchema {
419419
func (c *coordinator) LoadSchema(name string) (resources.ResourcesSchema, error) {
420420
c.mutex.Lock()
421421
defer c.mutex.Unlock()
422-
if x, ok := builtinProviders[name]; ok {
422+
if x, ok := BuiltinProviders[name]; ok {
423423
return x.Runtime.Schema, nil
424424
}
425425

providers/providers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func ListAll() ([]*Provider, error) {
287287
all = append(all, cur...)
288288
}
289289

290-
for _, x := range builtinProviders {
290+
for _, x := range BuiltinProviders {
291291
all = append(all, &Provider{
292292
Provider: x.Config,
293293
Schema: x.Runtime.Schema,

0 commit comments

Comments
 (0)