File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
main/groovy/nextflow/fusion
test/groovy/nextflow/fusion Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments