allow to disable REST API

Fixes #987

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-09-22 17:27:00 +02:00
parent 6c7b3ac5bb
commit 7ae9303c99
8 changed files with 239 additions and 177 deletions

View File

@@ -410,6 +410,8 @@ type Binding struct {
// Enable the built-in client interface.
// You have to define TemplatesPath and StaticFilesPath for this to work
EnableWebClient bool `json:"enable_web_client" mapstructure:"enable_web_client"`
// Enable REST API
EnableRESTAPI bool `json:"enable_rest_api" mapstructure:"enable_rest_api"`
// Defines the login methods available for the WebAdmin and WebClient UIs:
//
// - 0 means any configured method: username/password login form and OIDC, if enabled
@@ -522,6 +524,9 @@ func (b *Binding) GetAddress() string {
// IsValid returns true if the binding is valid
func (b *Binding) IsValid() bool {
if !b.EnableRESTAPI && !b.EnableWebAdmin && !b.EnableWebClient {
return false
}
if b.Port > 0 {
return true
}