Class KonfigyrExtension

java.lang.Object
com.konfigyr.gradle.KonfigyrExtension

@NullMarked public class KonfigyrExtension extends Object
Configuration extension for the Konfigyr Gradle plugin.

Exposes the konfigyr { } DSL block in the consuming project's build script. Every registry this project publishes to is declared in the registries container, either the well-known konfigyrCentral() registry:


 konfigyr {
     registries {
         konfigyrCentral() // credentials resolve from KONFIGYR_CLIENT_ID/KONFIGYR_CLIENT_SECRET/
                            // KONFIGYR_SUBJECT_TOKEN environment variables, exactly as before
     }

     // Optional: only needed for the service-release scenario - calling this block at all is what
     // opts a project into it, regardless of what's configured inside
     service {
         name = "order-service" // must match this service's identifier in the Konfigyr app
     }

     // Optional: direct-publish polling behavior
     publish {
         pollTimeout  = 10000L // defaults to 10 minutes
         pollInterval = 1000L  // defaults to 1 second
     }
 }

or a custom, self-hosted registry, which requires an explicit url and every credential set explicitly - no environment variable defaulting applies:


 konfigyr {
     registries {
         registry("staging") {
             url = uri("https://staging.konfigyr.io")

             tokenExchange {
                 clientId         = "acme-corp-client"
                 subjectToken     = "..."
                 subjectTokenType = "urn:ietf:params:oauth:token-type:jwt"
             }
         }
     }
 }

Every declared registry receives its own publish/release request when the relevant task runs, there is no "active" or "selected" registry, mirroring how Gradle's own maven-publish plugin generates one publish task per declared repository.

A registry's url must use https, unless the host is a loopback address, or insecure is set to true.

Since:
1.0.0
See Also:
  • Constructor Details

    • KonfigyrExtension

      public KonfigyrExtension(org.gradle.api.Project project, org.gradle.api.model.ObjectFactory factory)
      Creates a new KonfigyrExtension instance.
      Parameters:
      project - the Gradle project
      factory - the Gradle object factory
  • Method Details

    • registries

      public void registries(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<RegistrySpec>> action)
      Configures the registries container directly, using Gradle's own container idiom.
      Parameters:
      action - configures the registries container, cannot be null.
    • konfigyrCentral

      public RegistrySpec konfigyrCentral()
      Registers (or looks up) the well-known Konfigyr Central registry under the reserved "konfigyrCentral" name. Its url defaults to Registry.DEFAULT_HOST, and its credentials resolve from the KONFIGYR_CLIENT_ID/KONFIGYR_CLIENT_SECRET/KONFIGYR_SUBJECT_TOKEN environment variables when not set explicitly.
      Returns:
      the Konfigyr Central registry, never null.
    • konfigyrCentral

      public RegistrySpec konfigyrCentral(org.gradle.api.Action<RegistrySpec> action)
      Registers (or looks up) the well-known Konfigyr Central registry, applying the given action to override its conventions.
      Parameters:
      action - configures the registry, cannot be null.
      Returns:
      the Konfigyr Central registry, never null.
      See Also:
    • registry

      public RegistrySpec registry(String name, org.gradle.api.Action<RegistrySpec> action)
      Registers (or looks up) a custom, self-hosted registry under the given name. Every value, including its url and its credentials, must be set explicitly, no environment variable defaulting applies, unlike konfigyrCentral().
      Parameters:
      name - the registry name, cannot be the reserved "konfigyrCentral" name.
      action - configures the registry, cannot be null.
      Returns:
      the registry, never null.
    • service

      public void service(org.gradle.api.Action<KonfigyrExtension.ServiceSpec> action)
      Opts this project into the service-release scenario, configuring its service identity. Calling this at all, regardless of what's configured inside, is what enables the scenario; a pure library that never calls it skips it entirely.
      Parameters:
      action - configures the service identity, cannot be null.
    • publish

      public void publish(org.gradle.api.Action<KonfigyrExtension.PublishSpec> action)
      Parameters:
      action - configures the publication behavior, cannot be null.
    • getRegistries

      public org.gradle.api.NamedDomainObjectContainer<RegistrySpec> getRegistries()
      Every registry this project should publish its artifact metadata and service releases to.

      Populated either via konfigyrCentral() or registry(String, Action).

    • getService

      public KonfigyrExtension.ServiceSpec getService()
      This project's service identity, used by the service-release scenario. Always present, populated with its conventions regardless of whether service(Action) is ever called, configuring it is only needed to override those conventions.
    • getPublish

      public KonfigyrExtension.PublishSpec getPublish()
      Direct-publish polling behavior. Always present, populated with its conventions regardless of whether publish(Action) is ever called, configuring it is only needed to override those conventions.