Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed depreacted configs #325

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
38 changes: 3 additions & 35 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ type ControlServerConfig struct {
ServerBindAddr string

// Path to `web` base dir
WebBasedir string
WebBasedir string

// TODO: refactor control server config out of the base ferry at some point
// This adds optional buttons in the web ui that runs a script located at the
Expand Down Expand Up @@ -788,14 +788,6 @@ type Config struct {
// The following configs are updatable via the `Config.Update` method and should be passed by pointer

UpdatableConfig UpdatableConfig

// ----------------------------------------------------------------------------------------------------------------
// DEPRECATED CONFIGS
// The following configs are deprecated
DataIterationBatchSize uint64 // replaced by UpdatableConfig.DataIterationBatchSize
ServerBindAddr string // replaced by ControlServerConfig.ServerBindAddr
WebBasedir string // replaced by ControlServerConfig.WebBasedir
ControlServerCustomScripts map[string][]string // replaced by ControlServerConfig.CustomScripts
}

func (c *Config) ValidateConfig() error {
Expand Down Expand Up @@ -829,13 +821,11 @@ func (c *Config) ValidateConfig() error {
c.ControlServerConfig = &ControlServerConfig{}
}

c.checkForDeprecatedConfig()

if err := c.ControlServerConfig.Validate(); err != nil {
return fmt.Errorf("control_server: %s", err)
}

if c.DBWriteRetries == 0 {
if c.DBWriteRetries == 0 {
c.DBWriteRetries = 5
}

Expand Down Expand Up @@ -870,29 +860,7 @@ func (c *Config) ValidateConfig() error {
return nil
}

func (c *Config) checkForDeprecatedConfig() {
if c.DataIterationBatchSize != 0 {
c.logDeprecated("DataIterationBatchSize", "UpdatableConfig.DataIterationBatchSize")
c.UpdatableConfig.DataIterationBatchSize = c.DataIterationBatchSize
}

if c.ServerBindAddr != "" {
c.logDeprecated("ServerBindAddr", "ControlServerConfig.ServerBindAddr")
c.ControlServerConfig.ServerBindAddr = c.ServerBindAddr
}

if c.WebBasedir != "" {
c.logDeprecated("WebBasedir", "ControlServerConfig.WebBasedir")
c.ControlServerConfig.WebBasedir = c.WebBasedir
}

if len(c.ControlServerCustomScripts) != 0 {
c.logDeprecated("ControlServerCustomScripts", "ControlServerConfig.CustomScripts")
c.ControlServerConfig.CustomScripts= c.ControlServerCustomScripts
}
}

func (c *Config) logDeprecated(deprecatedConfig string, newConfig string) {
func (c *Config) logDeprecated(deprecatedConfig string, newConfig string) {
logrus.Warnf("Config.%s is deprecated in favour of Config.%s", deprecatedConfig, newConfig)
}

Expand Down