Class KonfigyrExtension
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classPolling behavior for the direct-publish scenario, used while waiting for acom.konfigyr.artifactory.Publicationto be confirmed afterPublishArtifactMetadataTaskuploads this project's own artifact metadata.static final classThis project's service identity, used to resolve its dependencies and open a service release against the Konfigyr Artifactory. -
Constructor Summary
ConstructorsConstructorDescriptionKonfigyrExtension(org.gradle.api.Project project, org.gradle.api.model.ObjectFactory factory) Creates a newKonfigyrExtensioninstance. -
Method Summary
Modifier and TypeMethodDescriptionDirect-publish polling behavior.org.gradle.api.NamedDomainObjectContainer<RegistrySpec> Every registry this project should publish its artifact metadata and service releases to.This project's service identity, used by the service-release scenario.Registers (or looks up) the well-known Konfigyr Central registry under the reserved "konfigyrCentral" name.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.voidpublish(org.gradle.api.Action<KonfigyrExtension.PublishSpec> action) Configures thedirect-publish polling behavior.voidregistries(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<RegistrySpec>> action) Configures theregistriescontainer directly, using Gradle's own container idiom.registry(String name, org.gradle.api.Action<RegistrySpec> action) Registers (or looks up) a custom, self-hosted registry under the given name.voidservice(org.gradle.api.Action<KonfigyrExtension.ServiceSpec> action) Opts this project into the service-release scenario, configuring itsservice identity.
-
Constructor Details
-
KonfigyrExtension
public KonfigyrExtension(org.gradle.api.Project project, org.gradle.api.model.ObjectFactory factory) Creates a newKonfigyrExtensioninstance.- Parameters:
project- the Gradle projectfactory- the Gradle object factory
-
-
Method Details
-
registries
public void registries(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<RegistrySpec>> action) Configures theregistriescontainer directly, using Gradle's own container idiom.- Parameters:
action- configures the registries container, cannot be null.
-
konfigyrCentral
Registers (or looks up) the well-known Konfigyr Central registry under the reserved "konfigyrCentral" name. Itsurldefaults toRegistry.DEFAULT_HOST, and its credentials resolve from theKONFIGYR_CLIENT_ID/KONFIGYR_CLIENT_SECRET/KONFIGYR_SUBJECT_TOKENenvironment variables when not set explicitly.- Returns:
- the Konfigyr Central registry, never null.
-
konfigyrCentral
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
Registers (or looks up) a custom, self-hosted registry under the given name. Every value, including itsurland its credentials, must be set explicitly, no environment variable defaulting applies, unlikekonfigyrCentral().- Parameters:
name- the registry name, cannot be the reserved "konfigyrCentral" name.action- configures the registry, cannot be null.- Returns:
- the registry, never null.
-
service
Opts this project into the service-release scenario, configuring itsservice 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
Configures thedirect-publish polling behavior.- Parameters:
action- configures the publication behavior, cannot be null.
-
getRegistries
Every registry this project should publish its artifact metadata and service releases to.Populated either via
konfigyrCentral()orregistry(String, Action). -
getService
This project's service identity, used by the service-release scenario. Always present, populated with its conventions regardless of whetherservice(Action)is ever called, configuring it is only needed to override those conventions. -
getPublish
Direct-publish polling behavior. Always present, populated with its conventions regardless of whetherpublish(Action)is ever called, configuring it is only needed to override those conventions.
-