Skip to content

Commit a1d0846

Browse files
committed
Fusion config improvement [ci fast]
Signed-off-by: Paolo Di Tommaso <[email protected]>
1 parent bb890d9 commit a1d0846

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

modules/nextflow/src/main/groovy/nextflow/fusion/FusionConfig.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ class FusionConfig {
4646
this.enabled = opts.enabled
4747
this.exportAwsAccessKeys = opts.exportAwsAccessKeys
4848
this.containerConfigUrl = opts.containerConfigUrl?.toString() ?: env.get('FUSION_CONTAINER_CONFIG_URL')
49-
if( containerConfigUrl && (!containerConfigUrl.startsWith('http://') && !containerConfigUrl.startsWith('https://')))
49+
if( containerConfigUrl && !validProtocol(containerConfigUrl))
5050
throw new IllegalArgumentException("Fusion container config URL should start with 'http:' or 'https:' protocol prefix - offending value: $containerConfigUrl")
5151
}
5252

53+
protected boolean validProtocol(String url) {
54+
url.startsWith('http://') || url.startsWith('https://') || url.startsWith('file:/')
55+
}
56+
5357
}

modules/nextflow/src/test/groovy/nextflow/fusion/FusionConfigTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class FusionConfigTest extends Specification {
5151
OPTS | ENV | EXPECTED
5252
[:] | [:] | null
5353
[containerConfigUrl:'http://foo.com'] | [:] | 'http://foo.com'
54+
[containerConfigUrl:'https://bar.com'] | [:] | 'https://bar.com'
55+
[containerConfigUrl:'file:///some/file']| [:] | 'file:///some/file'
5456
[:] | [FUSION_CONTAINER_CONFIG_URL:'http://bar.com'] | 'http://bar.com'
5557
[containerConfigUrl:'http://foo.com'] | [FUSION_CONTAINER_CONFIG_URL:'http://bar.com'] | 'http://foo.com'
5658

0 commit comments

Comments
 (0)