mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 14:20:55 +03:00
allow to disable REST API
Fixes #987 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user