Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Configure general Wave application settings, such as application name, port, ano
`wave.tokens.cache.duration` *(optional)*
: Cache duration for tokens generated by Wave (default: `36h`).

`wave.views.enabled` *(optional)*
: When `true`, the HTML view pages served under `/view/**` (build, mirror, scan, container, and inspect pages) are enabled (default: `true`).
Set to `false` to disable these pages globally, in which case all `/view/**` routes return `404`.

## Container registry

Wave uses the generic format `wave.registries.<REGISTRY_NAME>.username` and `wave.registries.<REGISTRY_NAME>.password` for registry authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import java.util.regex.Pattern
import groovy.transform.Canonical
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import io.micronaut.context.annotation.Requires
import io.micronaut.context.annotation.Value
import io.micronaut.core.annotation.Nullable
import io.micronaut.http.HttpRequest
Expand Down Expand Up @@ -74,6 +75,7 @@ import static io.seqera.wave.util.DataTimeUtils.formatTimestamp
*/
@Slf4j
@CompileStatic
@Requires(property = 'wave.views.enabled', value = 'true', defaultValue = 'true')
@Controller("/view")
@ExecuteOn(TaskExecutors.BLOCKING)
class ViewController {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ micronaut:
---
wave:
allowAnonymous: true
views:
# when 'false' the HTML view pages under /view/** are disabled globally (default: true)
enabled: true
server:
url: "${WAVE_SERVER_URL:`http://localhost:9090`}"
security:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Wave, containers provisioning service
* Copyright (c) 2023-2026, Seqera Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package io.seqera.wave.controller

import spock.lang.Specification

import io.micronaut.context.ApplicationContext
import io.micronaut.context.annotation.Property
import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpStatus
import io.micronaut.http.client.HttpClient
import io.micronaut.http.client.annotation.Client
import io.micronaut.http.client.exceptions.HttpClientResponseException
import io.micronaut.test.extensions.spock.annotation.MicronautTest
import jakarta.inject.Inject

/**
* Verify that the /view/** pages are disabled when 'wave.views.enabled' is false.
*
* @author Gavin Elder
*/
@Property(name = 'wave.server.url', value = 'http://foo.com')
@Property(name = 'wave.views.enabled', value = 'false')
@MicronautTest
class ViewControllerDisabledTest extends Specification {

@Inject
@Client("/")
HttpClient client

@Inject
ApplicationContext applicationContext

def 'should not load the view controller when views are disabled'() {
expect:
!applicationContext.containsBean(ViewController)
}

def 'should return not found for view pages when views are disabled'() {
when:
client.toBlocking().exchange(HttpRequest.GET(uri))

then:
def e = thrown(HttpClientResponseException)
e.status == HttpStatus.NOT_FOUND

where:
uri << [
'/view/builds/bd-12345',
'/view/mirrors/mr-12345',
'/view/scans/sc-12345',
'/view/containers/1234567890ab',
]
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Wave, containers provisioning service
* Copyright (c) 2023-2026, Seqera Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package io.seqera.wave.controller

import spock.lang.Specification

import io.micronaut.context.ApplicationContext
import io.micronaut.context.annotation.Property
import io.micronaut.test.extensions.spock.annotation.MicronautTest
import jakarta.inject.Inject

/**
* Verify that the /view/** pages are served when 'wave.views.enabled' is true.
*
* @author Gavin Elder
*/
@Property(name = 'wave.server.url', value = 'http://foo.com')
@Property(name = 'wave.views.enabled', value = 'true')
@MicronautTest
class ViewControllerEnabledTest extends Specification {

@Inject
ApplicationContext applicationContext

def 'should load the view controller when views are enabled'() {
expect:
applicationContext.containsBean(ViewController)
}

}
Loading