2022-06-28 03:15:50 +00:00
package configuration
import (
2023-05-07 05:48:26 +00:00
"fmt"
"github.com/authelia/authelia/v4/internal/configuration/schema"
2022-06-28 03:15:50 +00:00
"github.com/authelia/authelia/v4/internal/model"
)
// Deprecation represents a deprecated configuration key.
type Deprecation struct {
Version model . SemanticVersion
Key string
NewKey string
AutoMap bool
2023-05-07 06:39:17 +00:00
Keep bool
2022-10-05 05:05:23 +00:00
MapFunc func ( value any ) any
2023-05-07 05:48:26 +00:00
ErrFunc func ( d Deprecation , keysFinal map [ string ] any , value any , val * schema . StructValidator )
2022-06-28 03:15:50 +00:00
}
var deprecations = map [ string ] Deprecation {
"logs_level" : {
Version : model . SemanticVersion { Major : 4 , Minor : 7 } ,
Key : "logs_level" ,
NewKey : "log.level" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"logs_file" : {
Version : model . SemanticVersion { Major : 4 , Minor : 7 } ,
Key : "logs_file" ,
NewKey : "log.file_path" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"authentication_backend.ldap.skip_verify" : {
Version : model . SemanticVersion { Major : 4 , Minor : 25 } ,
Key : "authentication_backend.ldap.skip_verify" ,
NewKey : "authentication_backend.ldap.tls.skip_verify" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"authentication_backend.ldap.minimum_tls_version" : {
Version : model . SemanticVersion { Major : 4 , Minor : 25 } ,
Key : "authentication_backend.ldap.minimum_tls_version" ,
NewKey : "authentication_backend.ldap.tls.minimum_version" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"notifier.smtp.disable_verify_cert" : {
Version : model . SemanticVersion { Major : 4 , Minor : 25 } ,
Key : "notifier.smtp.disable_verify_cert" ,
NewKey : "notifier.smtp.tls.skip_verify" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"notifier.smtp.trusted_cert" : {
Version : model . SemanticVersion { Major : 4 , Minor : 25 } ,
Key : "notifier.smtp.trusted_cert" ,
NewKey : "certificates_directory" ,
AutoMap : false ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"host" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
2023-04-08 11:22:06 +00:00
Key : "host" ,
2022-06-28 03:15:50 +00:00
NewKey : "server.host" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"port" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
Key : "port" ,
NewKey : "server.port" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"tls_key" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
Key : "tls_key" ,
NewKey : "server.tls.key" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"tls_cert" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
Key : "tls_cert" ,
NewKey : "server.tls.certificate" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"log_level" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
Key : "log_level" ,
NewKey : "log.level" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"log_file_path" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
Key : "log_file_path" ,
NewKey : "log.file_path" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
"log_format" : {
Version : model . SemanticVersion { Major : 4 , Minor : 30 } ,
Key : "log_format" ,
NewKey : "log.format" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
2022-08-08 21:50:12 +00:00
"storage.postgres.sslmode" : {
Version : model . SemanticVersion { Major : 4 , Minor : 36 } ,
Key : "storage.postgres.sslmode" ,
NewKey : "storage.postgres.ssl.mode" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-08-08 21:50:12 +00:00
} ,
2022-06-28 03:15:50 +00:00
"authentication_backend.disable_reset_password" : {
Version : model . SemanticVersion { Major : 4 , Minor : 36 } ,
Key : "authentication_backend.disable_reset_password" ,
NewKey : "authentication_backend.password_reset.disable" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-06-28 03:15:50 +00:00
} ,
2022-08-08 21:50:12 +00:00
"server.read_buffer_size" : {
2022-09-01 02:44:53 +00:00
Version : model . SemanticVersion { Major : 4 , Minor : 36 } ,
2022-08-08 21:50:12 +00:00
Key : "server.read_buffer_size" ,
NewKey : "server.buffers.read" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-08-08 21:50:12 +00:00
} ,
"server.write_buffer_size" : {
2022-09-01 02:44:53 +00:00
Version : model . SemanticVersion { Major : 4 , Minor : 36 } ,
2022-08-08 21:50:12 +00:00
Key : "server.write_buffer_size" ,
NewKey : "server.buffers.write" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2022-08-08 21:50:12 +00:00
} ,
2023-01-12 10:57:44 +00:00
"session.remember_me_duration" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "session.remember_me_duration" ,
NewKey : "session.remember_me" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2023-01-12 10:57:44 +00:00
} ,
2023-01-25 09:36:40 +00:00
"server.enable_pprof" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "server.enable_pprof" ,
NewKey : "server.endpoints.enable_pprof" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
2023-01-25 09:36:40 +00:00
} ,
"server.enable_expvars" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "server.enable_expvars" ,
NewKey : "server.endpoints.enable_expvars" ,
AutoMap : true ,
MapFunc : nil ,
2023-05-07 05:48:26 +00:00
ErrFunc : nil ,
} ,
"server.host" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "server.host" ,
NewKey : "server.address" ,
AutoMap : false ,
2023-05-07 06:39:17 +00:00
Keep : true ,
2023-05-07 05:48:26 +00:00
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
2023-05-30 08:21:19 +00:00
val . PushWarning ( fmt . Errorf ( "configuration key '%s' is deprecated in %s and has been replaced by '%s' when combined with the 'server.port' and 'server.path' in the format of %s: this should be automatically mapped for you but you will need to adjust your configuration to remove this message" , d . Key , d . Version . String ( ) , d . NewKey , "'[tcp[(4|6)]://]<hostname>[:<port>][/<path>]' or 'tcp[(4|6)://][hostname]:<port>[/<path>]'" ) )
2023-05-07 05:48:26 +00:00
} ,
} ,
"server.port" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "server.port" ,
NewKey : "server.address" ,
AutoMap : false ,
2023-05-07 06:39:17 +00:00
Keep : true ,
2023-05-07 05:48:26 +00:00
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
2023-05-30 08:21:19 +00:00
val . PushWarning ( fmt . Errorf ( "configuration key '%s' is deprecated in %s and has been replaced by '%s' when combined with the 'server.host' and 'server.path' in the format of %s: this should be automatically mapped for you but you will need to adjust your configuration to remove this message" , d . Key , d . Version . String ( ) , d . NewKey , "'[tcp[(4|6)]://]<hostname>[:<port>][/<path>]' or 'tcp[(4|6)://][hostname]:<port>[/<path>]'" ) )
} ,
} ,
"server.path" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "server.path" ,
NewKey : "server.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
val . PushWarning ( fmt . Errorf ( "configuration key '%s' is deprecated in %s and has been replaced by '%s' when combined with the 'server.host' and 'server.port' in the format of %s: this should be automatically mapped for you but you will need to adjust your configuration to remove this message" , d . Key , d . Version . String ( ) , d . NewKey , "'[tcp[(4|6)]://]<hostname>[:<port>][/<path>]' or 'tcp[(4|6)://][hostname]:<port>[/<path>]'" ) )
2023-05-07 05:48:26 +00:00
} ,
2023-01-25 09:36:40 +00:00
} ,
2023-05-07 06:39:17 +00:00
"storage.mysql.host" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "storage.mysql.host" ,
NewKey : "storage.mysql.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
2023-05-30 08:21:19 +00:00
val . PushWarning ( fmt . Errorf ( errFmtSpecialRemappedKey , d . Key , d . Version . String ( ) , d . NewKey , "storage.mysql.port" , "[tcp://]<hostname>[:<port>]" ) )
2023-05-07 06:39:17 +00:00
} ,
} ,
"storage.mysql.port" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "storage.mysql.port" ,
NewKey : "storage.mysql.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
2023-05-30 08:21:19 +00:00
val . PushWarning ( fmt . Errorf ( errFmtSpecialRemappedKey , d . Key , d . Version . String ( ) , d . NewKey , "storage.mysql.host" , "[tcp://]<hostname>[:<port>]" ) )
2023-05-07 06:39:17 +00:00
} ,
} ,
"storage.postgres.host" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "storage.postgres.host" ,
NewKey : "storage.postgres.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
2023-05-30 08:21:19 +00:00
val . PushWarning ( fmt . Errorf ( errFmtSpecialRemappedKey , d . Key , d . Version . String ( ) , d . NewKey , "storage.postgres.port" , "[tcp://]<hostname>[:<port>]" ) )
2023-05-07 06:39:17 +00:00
} ,
} ,
"storage.postgres.port" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "storage.postgres.port" ,
NewKey : "storage.postgres.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
2023-05-30 08:21:19 +00:00
val . PushWarning ( fmt . Errorf ( errFmtSpecialRemappedKey , d . Key , d . Version . String ( ) , d . NewKey , "storage.postgres.host" , "[tcp://]<hostname>[:<port>]" ) )
} ,
} ,
"notifier.smtp.host" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "notifier.smtp.host" ,
NewKey : "notifier.smtp.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
val . PushWarning ( fmt . Errorf ( errFmtSpecialRemappedKey , d . Key , d . Version . String ( ) , d . NewKey , "notifier.smtp.port" , "[tcp://]<hostname>[:<port>]" ) )
} ,
} ,
"notifier.smtp.port" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "notifier.smtp.port" ,
NewKey : "notifier.smtp.address" ,
AutoMap : false ,
Keep : true ,
MapFunc : nil ,
ErrFunc : func ( d Deprecation , _ map [ string ] any , _ any , val * schema . StructValidator ) {
val . PushWarning ( fmt . Errorf ( errFmtSpecialRemappedKey , d . Key , d . Version . String ( ) , d . NewKey , "notifier.smtp.host" , "[tcp://]<hostname>[:<port>]" ) )
2023-05-07 06:39:17 +00:00
} ,
} ,
"authentication_backend.ldap.url" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "authentication_backend.ldap.url" ,
NewKey : "authentication_backend.ldap.address" ,
AutoMap : true ,
MapFunc : nil ,
ErrFunc : nil ,
} ,
2023-05-15 00:32:10 +00:00
"identity_providers.oidc.clients[].userinfo_signing_algorithm" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "identity_providers.oidc.clients[].userinfo_signing_algorithm" ,
NewKey : "identity_providers.oidc.clients[].userinfo_signing_alg" ,
AutoMap : true ,
MapFunc : nil ,
ErrFunc : nil ,
} ,
2023-06-18 04:40:38 +00:00
"authentication_backend.ldap.username_attribute" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "authentication_backend.ldap.username_attribute" ,
NewKey : "authentication_backend.ldap.attributes.username" ,
AutoMap : true ,
MapFunc : nil ,
ErrFunc : nil ,
} ,
"authentication_backend.ldap.mail_attribute" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "authentication_backend.ldap.mail_attribute" ,
NewKey : "authentication_backend.ldap.attributes.mail" ,
AutoMap : true ,
MapFunc : nil ,
ErrFunc : nil ,
} ,
"authentication_backend.ldap.display_name_attribute" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "authentication_backend.ldap.display_name_attribute" ,
NewKey : "authentication_backend.ldap.attributes.display_name" ,
AutoMap : true ,
MapFunc : nil ,
ErrFunc : nil ,
} ,
"authentication_backend.ldap.group_name_attribute" : {
Version : model . SemanticVersion { Major : 4 , Minor : 38 } ,
Key : "authentication_backend.ldap.group_name_attribute" ,
NewKey : "authentication_backend.ldap.attributes.group_name" ,
AutoMap : true ,
MapFunc : nil ,
ErrFunc : nil ,
} ,
2022-06-28 03:15:50 +00:00
}