Skip to content

Commit 6c68022

Browse files
committed
Merge branch '439-disable-config-modification' into 'master'
fix(engine): disable config modification (#439) Closes #439 See merge request postgres-ai/database-lab!641
2 parents 77bb273 + 9fcd91b commit 6c68022

File tree

13 files changed

+35
-35
lines changed

13 files changed

+35
-35
lines changed

engine/api/swagger-spec/dblab_server_swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ definitions:
686686
format: "date-time"
687687
telemetry:
688688
type: boolean
689-
allowModifyingConfig:
689+
disableConfigModification:
690690
type: boolean
691691

692692
PoolEntry:

engine/configs/config.example.logical_generic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Allow modifying configuration via UI/API. Default: true.
27-
allowModifyingConfig: true
26+
# Disable modifying configuration via UI/API. Default: false.
27+
disableConfigModification: false
2828

2929
# Embedded UI. Controls the application to provide a user interface to DLE API.
3030
embeddedUI:

engine/configs/config.example.logical_rds_iam.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Allow modifying configuration via UI/API. Default: true.
27-
allowModifyingConfig: true
26+
# Disable modifying configuration via UI/API. Default: false.
27+
disableConfigModification: false
2828

2929
# Embedded UI. Controls the application to provide a user interface to DLE API.
3030
embeddedUI:

engine/configs/config.example.physical_generic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Allow modifying configuration via UI/API. Default: true.
27-
allowModifyingConfig: true
26+
# Disable modifying configuration via UI/API. Default: false.
27+
disableConfigModification: false
2828

2929
# Embedded UI. Controls the application to provide a user interface to DLE API.
3030
embeddedUI:

engine/configs/config.example.physical_pgbackrest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Allow modifying configuration via UI/API. Default: true.
27-
allowModifyingConfig: true
26+
# Disable modifying configuration via UI/API. Default: false.
27+
disableConfigModification: false
2828

2929
# Embedded UI. Controls the application to provide a user interface to DLE API.
3030
embeddedUI:

engine/configs/config.example.physical_walg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ server:
2323
# HTTP server port. Default: 2345.
2424
port: 2345
2525

26-
# Allow modifying configuration via UI/API. Default: true.
27-
allowModifyingConfig: true
26+
# Disable modifying configuration via UI/API. Default: false.
27+
disableConfigModification: false
2828

2929
# Embedded UI. Controls the application to provide a user interface to DLE API.
3030
embeddedUI:

engine/internal/srv/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (s *Server) getAdminConfigYaml(w http.ResponseWriter, r *http.Request) {
6060
}
6161

6262
func (s *Server) setProjectedAdminConfig(w http.ResponseWriter, r *http.Request) {
63-
if !s.Config.AllowModifyingConfig {
63+
if s.Config.DisableConfigModification {
6464
api.SendBadRequestError(w, r, configManagementDenied)
6565
return
6666
}
@@ -99,7 +99,7 @@ func (s *Server) setProjectedAdminConfig(w http.ResponseWriter, r *http.Request)
9999
}
100100

101101
func (s *Server) testDBSource(w http.ResponseWriter, r *http.Request) {
102-
if !s.Config.AllowModifyingConfig {
102+
if s.Config.DisableConfigModification {
103103
api.SendBadRequestError(w, r, configManagementDenied)
104104
return
105105
}

engine/internal/srv/config/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Package config contains configuration options of HTTP server.
66
package config
77

8-
// Config provides configuration for an HTTP server of the Database Lab.
8+
// Config provides configuration management via DLE API
99
type Config struct {
10-
VerificationToken string `yaml:"verificationToken" json:"-"`
11-
Host string `yaml:"host"`
12-
Port uint `yaml:"port"`
13-
AllowModifyingConfig bool `yaml:"allowModifyingConfig" json:"-"`
10+
VerificationToken string `yaml:"verificationToken" json:"-"`
11+
Host string `yaml:"host"`
12+
Port uint `yaml:"port"`
13+
DisableConfigModification bool `yaml:"disableConfigModification" json:"-"`
1414
}

engine/internal/srv/server.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ func (s *Server) instanceStatus() *models.InstanceStatus {
111111
Message: models.InstanceMessageOK,
112112
},
113113
Engine: models.Engine{
114-
Version: version.GetVersion(),
115-
Edition: s.engProps.GetEdition(),
116-
StartedAt: s.startedAt,
117-
Telemetry: pointer.ToBool(s.tm.IsEnabled()),
118-
AllowModifyingConfig: pointer.ToBool(s.Config.AllowModifyingConfig),
114+
Version: version.GetVersion(),
115+
Edition: s.engProps.GetEdition(),
116+
StartedAt: s.startedAt,
117+
Telemetry: pointer.ToBool(s.tm.IsEnabled()),
118+
DisableConfigModification: pointer.ToBool(s.Config.DisableConfigModification),
119119
},
120120
Pools: s.provisioner.GetPoolEntryList(),
121121
Cloning: s.Cloning.GetCloningState(),

engine/pkg/models/instance_status.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ type Cloning struct {
4444

4545
// Engine represents info about Database Lab Engine instance.
4646
type Engine struct {
47-
Version string `json:"version"`
48-
Edition string `json:"edition"`
49-
StartedAt *LocalTime `json:"startedAt,omitempty"`
50-
Telemetry *bool `json:"telemetry,omitempty"`
51-
AllowModifyingConfig *bool `json:"allowModifyingConfig,omitempty"`
47+
Version string `json:"version"`
48+
Edition string `json:"edition"`
49+
StartedAt *LocalTime `json:"startedAt,omitempty"`
50+
Telemetry *bool `json:"telemetry,omitempty"`
51+
DisableConfigModification *bool `json:"disableConfigModification,omitempty"`
5252
}
5353

5454
// CloneList represents a list of clones.

0 commit comments

Comments
 (0)