Providers

Providers

In Confix, it's essential to specify where the system should search for component references. This is done by defining component providers. These providers can point to various sources, such as component registries or .NET packages, to locate the related components.

Getting Started

In this example we will configure the git provider and fetch components from a git repository.

If you use the dotnet-package provider, you will not need to reference components in the project file. This is all done over the package references!

Make sure you do have a repository that has defines a .confixrc a .confix.solution and a .confix.project file. For example like this:

To use a provider, you need to define them in the project.componentProviders section in your .confixrc file. We

{
  "project": {
    "componentProviders": [
      {
        "name": "shared", // <-- this is the name of the provider that we will use later
        "type": "git",
        "repositoryUrl": "https://github.com/SwissLife-OSS/Confix.git",
        "path": "examples/ComponentRegistry"
      }
    ],
    "configurationFiles": [
      {
        "type": "appsettings",
        "useUserSecrets": true
      }
    ]
  }
}

You can checkout the component registry here: https://github.com/SwissLife-OSS/Confix.git (opens in a new tab)

We can now add components to our project from the registry by calling

confix component add @shared/Example
✓ Running in scope Project
✓ Configuration loaded
✓ Component inputs loaded
✓ Component '@shared/Example' was added

By executing this command the component provider git is invoked and checks the repository for the component Example. If found, the component is added to the .confix.project.

Available Providers

Here's a look at some available component providers and their descriptions:

NameDescription
dotnet-packageLets confix discover components from .NET packages
gitDefines a git repository with confix components