Class OnePasswordExtension
java.lang.Object
io.github.arve0.onepassword.properties.OnePasswordExtension
Extension that provides a unified API to access project properties as lazy
Provider<String>.
Access via onePassword.property("KEY") in any build script where this plugin is applied.
The returned provider resolves identically regardless of whether the value came from
gradle.properties, an ORG_GRADLE_PROJECT_* environment variable, or a -P flag.
- Plain string values are wrapped in an eager
Provider<String>. op://references are resolved lazily via the 1Password CLI.
-
Constructor Summary
ConstructorsConstructorDescriptionOnePasswordExtension(org.gradle.api.Project project, io.github.arve0.onepassword.properties.OpCliClient cli) -
Method Summary
-
Constructor Details
-
OnePasswordExtension
public OnePasswordExtension(org.gradle.api.Project project, io.github.arve0.onepassword.properties.OpCliClient cli) - Parameters:
project- the Gradle project this extension is attached tocli- the 1Password CLI client used to resolveop://references
-
-
Method Details
-
property
Returns aProvider<String>for the given project property key.The returned provider behaves the same regardless of the property source:
gradle.properties, environment variable (ORG_GRADLE_PROJECT_*), or-P.If the property value starts with
op://, the provider resolves the secret via the 1Password CLI when.get()is called. For plain string values, the provider returns the value directly.- Parameters:
key- the project property key- Returns:
- a
Provider<String>for the property value - Throws:
PropertyResolutionException- if the property is not set
-