From bf0d8ed3dcf761ec5ddd77c9e2f0495eb6492f57 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Tue, 15 Oct 2024 16:59:46 +0200 Subject: [PATCH] feat(ocis): remove deprecated envvars Signed-off-by: jkoberg --- services/antivirus/pkg/config/config.go | 7 +++---- services/antivirus/pkg/config/parser/parse.go | 7 ------- services/notifications/pkg/channels/channels.go | 5 ----- services/notifications/pkg/config/config.go | 2 +- services/web/pkg/config/config.go | 7 +++---- services/web/pkg/config/parser/parse.go | 15 --------------- 6 files changed, 7 insertions(+), 36 deletions(-) diff --git a/services/antivirus/pkg/config/config.go b/services/antivirus/pkg/config/config.go index 7ce5b93ba..fd71d3fd2 100644 --- a/services/antivirus/pkg/config/config.go +++ b/services/antivirus/pkg/config/config.go @@ -73,8 +73,7 @@ type ClamAV struct { // ICAP provides configuration options for icap type ICAP struct { - DeprecatedTimeout int64 `yaml:"timeout" env:"ANTIVIRUS_ICAP_TIMEOUT" desc:"Timeout for the ICAP client." introductionVersion:"pre5.0" deprecationVersion:"5.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"Changing the envvar type for consistency reasons." deprecationReplacement:"ANTIVIRUS_ICAP_SCAN_TIMEOUT"` - Timeout time.Duration `yaml:"scan_timeout" env:"ANTIVIRUS_ICAP_SCAN_TIMEOUT" desc:"Scan timeout for the ICAP client. Defaults to '5m' (5 minutes). See the Environment Variable Types description for more details." introductionVersion:"5.0"` - URL string `yaml:"url" env:"ANTIVIRUS_ICAP_URL" desc:"URL of the ICAP server." introductionVersion:"pre5.0"` - Service string `yaml:"service" env:"ANTIVIRUS_ICAP_SERVICE" desc:"The name of the ICAP service." introductionVersion:"pre5.0"` + Timeout time.Duration `yaml:"scan_timeout" env:"ANTIVIRUS_ICAP_SCAN_TIMEOUT" desc:"Scan timeout for the ICAP client. Defaults to '5m' (5 minutes). See the Environment Variable Types description for more details." introductionVersion:"5.0"` + URL string `yaml:"url" env:"ANTIVIRUS_ICAP_URL" desc:"URL of the ICAP server." introductionVersion:"pre5.0"` + Service string `yaml:"service" env:"ANTIVIRUS_ICAP_SERVICE" desc:"The name of the ICAP service." introductionVersion:"pre5.0"` } diff --git a/services/antivirus/pkg/config/parser/parse.go b/services/antivirus/pkg/config/parser/parse.go index b762b9eb5..fab4c2f0c 100644 --- a/services/antivirus/pkg/config/parser/parse.go +++ b/services/antivirus/pkg/config/parser/parse.go @@ -2,10 +2,8 @@ package parser import ( "errors" - "time" ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config" - "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/services/antivirus/pkg/config" "github.com/owncloud/ocis/v2/services/antivirus/pkg/config/defaults" @@ -36,10 +34,5 @@ func ParseConfig(cfg *config.Config) error { // Validate validates our little config func Validate(cfg *config.Config) error { - if cfg.Scanner.ICAP.DeprecatedTimeout != 0 { - cfg.Scanner.ICAP.Timeout = time.Duration(cfg.Scanner.ICAP.DeprecatedTimeout) * time.Second - log.Deprecation("ANTIVIRUS_ICAP_TIMEOUT is deprecated, use ANTIVIRUS_ICAP_SCAN_TIMEOUT instead") - } - return nil } diff --git a/services/notifications/pkg/channels/channels.go b/services/notifications/pkg/channels/channels.go index c53ac84c6..89ecb87df 100644 --- a/services/notifications/pkg/channels/channels.go +++ b/services/notifications/pkg/channels/channels.go @@ -84,14 +84,9 @@ func (m Mail) getMailClient() (*mail.SMTPClient, error) { } switch strings.ToLower(m.conf.Notifications.SMTP.Encryption) { - case "tls": - server.Encryption = mail.EncryptionTLS - server.TLSConfig.ServerName = m.conf.Notifications.SMTP.Host case "starttls": server.Encryption = mail.EncryptionSTARTTLS server.TLSConfig.ServerName = m.conf.Notifications.SMTP.Host - case "ssl": - server.Encryption = mail.EncryptionSSL case "ssltls": server.Encryption = mail.EncryptionSSLTLS case "none": diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index 55d7d7e64..280a69547 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -46,7 +46,7 @@ type SMTP struct { Password string `yaml:"smtp_password" env:"NOTIFICATIONS_SMTP_PASSWORD" desc:"Password for the SMTP host to connect to." introductionVersion:"pre5.0"` Insecure bool `yaml:"insecure" env:"NOTIFICATIONS_SMTP_INSECURE" desc:"Allow insecure connections to the SMTP server." introductionVersion:"pre5.0"` Authentication string `yaml:"smtp_authentication" env:"NOTIFICATIONS_SMTP_AUTHENTICATION" desc:"Authentication method for the SMTP communication. Possible values are 'login', 'plain', 'crammd5', 'none' or 'auto'. If set to 'auto' or unset, the authentication method is automatically negotiated with the server." introductionVersion:"pre5.0"` - Encryption string `yaml:"smtp_encryption" env:"NOTIFICATIONS_SMTP_ENCRYPTION" desc:"Encryption method for the SMTP communication. Possible values are 'starttls', 'ssl', 'ssltls', 'tls' and 'none'." introductionVersion:"pre5.0" deprecationVersion:"5.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The NOTIFICATIONS_SMTP_ENCRYPTION values 'ssl' and 'tls' are deprecated and will be removed in the future." deprecationReplacement:"Use 'starttls' instead of 'tls' and 'ssltls' instead of 'ssl'."` + Encryption string `yaml:"smtp_encryption" env:"NOTIFICATIONS_SMTP_ENCRYPTION" desc:"Encryption method for the SMTP communication. Possible values are 'starttls', 'ssltls' and 'none'." introductionVersion:"pre5.0"` } // Events combines the configuration options for the event bus. diff --git a/services/web/pkg/config/config.go b/services/web/pkg/config/config.go index 34e5995d0..d5d931535 100644 --- a/services/web/pkg/config/config.go +++ b/services/web/pkg/config/config.go @@ -31,10 +31,9 @@ type Config struct { // Asset defines the available asset configuration. type Asset struct { - DeprecatedPath string `yaml:"path" env:"WEB_ASSET_PATH" desc:"Serve ownCloud Web assets from a path on the filesystem instead of the builtin assets." introductionVersion:"pre5.0" deprecationVersion:"5.1.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The WEB_ASSET_PATH is deprecated and will be removed in the future." deprecationReplacement:"Use WEB_ASSET_CORE_PATH instead."` - CorePath string `yaml:"core_path" env:"WEB_ASSET_CORE_PATH" desc:"Serve ownCloud Web assets from a path on the filesystem instead of the builtin assets. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/web/assets/core" introductionVersion:"6.0.0"` - ThemesPath string `yaml:"themes_path" env:"OCIS_ASSET_THEMES_PATH;WEB_ASSET_THEMES_PATH" desc:"Serve ownCloud themes from a path on the filesystem instead of the builtin assets. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/web/assets/themes" introductionVersion:"6.0.0"` - AppsPath string `yaml:"apps_path" env:"WEB_ASSET_APPS_PATH" desc:"Serve ownCloud Web apps assets from a path on the filesystem instead of the builtin assets. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/web/assets/apps" introductionVersion:"6.0.0"` + CorePath string `yaml:"core_path" env:"WEB_ASSET_CORE_PATH" desc:"Serve ownCloud Web assets from a path on the filesystem instead of the builtin assets. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/web/assets/core" introductionVersion:"6.0.0"` + ThemesPath string `yaml:"themes_path" env:"OCIS_ASSET_THEMES_PATH;WEB_ASSET_THEMES_PATH" desc:"Serve ownCloud themes from a path on the filesystem instead of the builtin assets. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/web/assets/themes" introductionVersion:"6.0.0"` + AppsPath string `yaml:"apps_path" env:"WEB_ASSET_APPS_PATH" desc:"Serve ownCloud Web apps assets from a path on the filesystem instead of the builtin assets. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/web/assets/apps" introductionVersion:"6.0.0"` } // CustomStyle references additional css to be loaded into ownCloud Web. diff --git a/services/web/pkg/config/parser/parse.go b/services/web/pkg/config/parser/parse.go index 4789b6aaa..5a2ffe5d6 100644 --- a/services/web/pkg/config/parser/parse.go +++ b/services/web/pkg/config/parser/parse.go @@ -5,7 +5,6 @@ import ( ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config" "github.com/owncloud/ocis/v2/ocis-pkg/config/envdecode" - "github.com/owncloud/ocis/v2/ocis-pkg/log" "github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/services/web/pkg/config" "github.com/owncloud/ocis/v2/services/web/pkg/config/defaults" @@ -45,19 +44,5 @@ func Validate(cfg *config.Config) error { return shared.MissingJWTTokenError(cfg.Service.Name) } - // deprecation: migration requested - // check if the config still uses the deprecated asset path, if so, - // log a warning and copy the value to the setting that is actually used - // this is to ensure a smooth transition from the old to the new core asset path (pre 5.1 to 5.1) - if cfg.Asset.DeprecatedPath != "" { - if cfg.Asset.CorePath == "" { - cfg.Asset.CorePath = cfg.Asset.DeprecatedPath - } - - // message should be logged to the console, - // do not use a logger here because the message MUST be visible independent of the log level - log.Deprecation("WEB_ASSET_PATH is deprecated and will be removed in the future. Use WEB_ASSET_CORE_PATH instead.") - } - return nil }