Skip to content

Commit 357edef

Browse files
pditommasoclaude
andcommitted
Standardize registry configuration to use 'apiKey' consistently
- Change property name from 'authToken' to 'apiKey' in RegistryReleaseConfig - Update all code references and test cases to use 'apiKey' - Add missing 'extensionPoints' configuration option to README - Clarify registry configuration documentation with specific examples for gradle.properties and environment variables - Remove redundant Option 4 from registry configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]>
1 parent 7130d35 commit 357edef

File tree

6 files changed

+32
-38
lines changed

6 files changed

+32
-38
lines changed

README.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The `nextflowPlugin` block supports the following configuration options:
4747
- **`provider`** (required) - The plugin provider/author name
4848
- **`description`** (optional) - A short description of the plugin
4949
- **`requirePlugins`** (optional) - List of plugin dependencies that must be present
50-
```
50+
- **`extensionPoints`** (optional) - List of extension point class names provided by the plugin
5151

5252
### Registry Configuration
5353

@@ -57,30 +57,24 @@ The `registry` block is optional and supports several configuration methods:
5757
```gradle
5858
registry {
5959
url = 'https://registry.nextflow.io/api'
60-
authToken = 'your-auth-token'
60+
apiKey = 'your-api-key'
6161
}
6262
```
6363

6464
**Option 2: Using project properties**
65-
```gradle
66-
registry {
67-
// Uses npr.apiUrl and npr.apiKey project properties as fallbacks
68-
}
65+
Define `npr.apiUrl` and `npr.apiKey` in your local `gradle.properties` OR `$HOME/.gradle/gradle.properties`:
66+
67+
```properties
68+
npr.apiUrl=https://registry.nextflow.io/api
69+
npr.apiKey=your-api-key
6970
```
7071

7172
**Option 3: Using environment variables**
72-
```gradle
73-
registry {
74-
// Uses NPR_API_URL and NPR_API_KEY environment variables as fallbacks
75-
}
76-
```
73+
Export environment variables in your shell:
7774

78-
**Option 4: No registry block (uses fallbacks)**
79-
```gradle
80-
nextflowPlugin {
81-
// ... other configuration ...
82-
// No registry block - will use npr.apiUrl/NPR_API_URL and npr.apiKey/NPR_API_KEY
83-
}
75+
```bash
76+
export NPR_API_URL=https://registry.nextflow.io/api
77+
export NPR_API_KEY=your-api-key
8478
```
8579

8680
The configuration precedence is: explicit values → project properties → environment variables → defaults.

src/main/groovy/io/nextflow/gradle/NextflowPluginConfig.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import org.gradle.api.Project
2020
* ]
2121
* registry {
2222
* url = 'https://registry.nextflow.io/api'
23-
* authToken = 'my-auth-token'
23+
* apiKey = 'my-api-key'
2424
* }
2525
* }
2626
* </pre>

src/main/groovy/io/nextflow/gradle/registry/RegistryClient.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RegistryClient {
3131
*/
3232
RegistryClient(URI url, String authToken) {
3333
if (!authToken)
34-
throw new RegistryReleaseException("Authentication token not specified - Provide a valid token in 'publishing.registry' configuration")
34+
throw new RegistryReleaseException("API key not specified - Provide a valid API key in 'publishing.registry' configuration")
3535
this.url = !url.toString().endsWith("/")
3636
? URI.create(url.toString() + "/")
3737
: url

src/main/groovy/io/nextflow/gradle/registry/RegistryReleaseConfig.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class RegistryReleaseConfig {
2020
String url
2121

2222
/**
23-
* The authentication token (bearer token) for registry access.
23+
* The API key (bearer token) for registry access.
2424
* Required for uploading plugins to the registry.
2525
*/
26-
String authToken
26+
String apiKey
2727

2828
RegistryReleaseConfig(Project project) {
2929
this.project = project
@@ -41,17 +41,17 @@ class RegistryReleaseConfig {
4141
}
4242

4343
/**
44-
* Gets the resolved auth token with fallback to environment variable.
45-
* @return the resolved auth token
46-
* @throws RuntimeException if no auth token is configured
44+
* Gets the resolved API key with fallback to environment variable.
45+
* @return the resolved API key
46+
* @throws RuntimeException if no API key is configured
4747
*/
4848
String getResolvedAuthToken() {
49-
def token = authToken ?:
49+
def token = apiKey ?:
5050
project.findProperty('npr.apiKey') ?:
5151
System.getenv('NPR_API_KEY')
5252

5353
if (!token) {
54-
throw new RuntimeException('Registry authentication token must be configured either via authToken property, npr.apiKey project property, or NPR_API_KEY environment variable')
54+
throw new RuntimeException('Registry API key must be configured either via apiKey property, npr.apiKey project property, or NPR_API_KEY environment variable')
5555
}
5656

5757
return token

src/test/groovy/io/nextflow/gradle/registry/RegistryReleaseConfigTest.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class RegistryReleaseConfigTest extends Specification {
6262
resolvedUrl == 'https://explicit-registry.com/api'
6363
}
6464

65-
def "should use explicit auth token configuration"() {
65+
def "should use explicit API key configuration"() {
6666
given:
67-
config.authToken = 'explicit-token'
67+
config.apiKey = 'explicit-token'
6868

6969
when:
7070
def resolvedToken = config.resolvedAuthToken
@@ -73,7 +73,7 @@ class RegistryReleaseConfigTest extends Specification {
7373
resolvedToken == 'explicit-token'
7474
}
7575

76-
def "should use project property for auth token when not explicitly set"() {
76+
def "should use project property for API key when not explicitly set"() {
7777
given:
7878
project.ext['npr.apiKey'] = 'project-property-token'
7979

@@ -84,9 +84,9 @@ class RegistryReleaseConfigTest extends Specification {
8484
resolvedToken == 'project-property-token'
8585
}
8686

87-
def "should prioritize explicit auth token over project property"() {
87+
def "should prioritize explicit API key over project property"() {
8888
given:
89-
config.authToken = 'explicit-token'
89+
config.apiKey = 'explicit-token'
9090
project.ext['npr.apiKey'] = 'project-token'
9191

9292
when:
@@ -96,13 +96,13 @@ class RegistryReleaseConfigTest extends Specification {
9696
resolvedToken == 'explicit-token'
9797
}
9898

99-
def "should throw exception when no auth token is configured"() {
99+
def "should throw exception when no API key is configured"() {
100100
when:
101101
config.resolvedAuthToken
102102

103103
then:
104104
def ex = thrown(RuntimeException)
105-
ex.message.contains('Registry authentication token must be configured')
105+
ex.message.contains('Registry API key must be configured')
106106
ex.message.contains('npr.apiKey project property')
107107
ex.message.contains('NPR_API_KEY environment variable')
108108
}

src/test/groovy/io/nextflow/gradle/registry/RegistryReleaseTaskTest.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class RegistryReleaseTaskTest extends Specification {
5353
then:
5454
// Should fail with token configuration error since no fallback token is available
5555
def ex = thrown(RuntimeException)
56-
ex.message.contains('Registry authentication token must be configured')
56+
ex.message.contains('Registry API key must be configured')
5757
}
5858

5959
def "should use default fallback configuration when empty registry block is provided"() {
@@ -75,7 +75,7 @@ class RegistryReleaseTaskTest extends Specification {
7575
then:
7676
// Should fail with token configuration error since no fallback token is available
7777
def ex = thrown(RuntimeException)
78-
ex.message.contains('Registry authentication token must be configured')
78+
ex.message.contains('Registry API key must be configured')
7979
}
8080

8181
def "should throw exception when auth token is not configured"() {
@@ -97,7 +97,7 @@ class RegistryReleaseTaskTest extends Specification {
9797

9898
then:
9999
def ex = thrown(RuntimeException)
100-
ex.message.contains('Registry authentication token must be configured')
100+
ex.message.contains('Registry API key must be configured')
101101
}
102102

103103
def "should use fallback configuration when explicit values not set"() {
@@ -110,7 +110,7 @@ class RegistryReleaseTaskTest extends Specification {
110110
extensionPoints = ['com.example.TestExtension']
111111
registry {
112112
url = 'https://example.com/registry'
113-
authToken = 'test-token'
113+
apiKey = 'test-token'
114114
}
115115
}
116116

@@ -133,7 +133,7 @@ class RegistryReleaseTaskTest extends Specification {
133133
extensionPoints = ['com.example.TestExtension']
134134
registry {
135135
url = 'https://example.com/registry'
136-
// No explicit auth token - will fall back to project property
136+
// No explicit API key - will fall back to project property
137137
}
138138
}
139139

0 commit comments

Comments
 (0)