mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
95a5e326a5
This removes the hardcoded schema value from the PostgreSQL existing tables query, making it compatible with the new schema config option.
65 lines
2.1 KiB
Go
65 lines
2.1 KiB
Go
package schema
|
|
|
|
import "time"
|
|
|
|
// LocalStorageConfiguration represents the configuration when using local storage.
|
|
type LocalStorageConfiguration struct {
|
|
Path string `koanf:"path"`
|
|
}
|
|
|
|
// SQLStorageConfiguration represents the configuration of the SQL database.
|
|
type SQLStorageConfiguration struct {
|
|
Host string `koanf:"host"`
|
|
Port int `koanf:"port"`
|
|
Database string `koanf:"database"`
|
|
Username string `koanf:"username"`
|
|
Password string `koanf:"password"`
|
|
Timeout time.Duration `koanf:"timeout"`
|
|
}
|
|
|
|
// MySQLStorageConfiguration represents the configuration of a MySQL database.
|
|
type MySQLStorageConfiguration struct {
|
|
SQLStorageConfiguration `koanf:",squash"`
|
|
}
|
|
|
|
// PostgreSQLStorageConfiguration represents the configuration of a PostgreSQL database.
|
|
type PostgreSQLStorageConfiguration struct {
|
|
SQLStorageConfiguration `koanf:",squash"`
|
|
Schema string `koanf:"schema"`
|
|
|
|
SSL PostgreSQLSSLStorageConfiguration `koanf:"ssl"`
|
|
|
|
// Deprecated. TODO: Remove in v4.36.0.
|
|
SSLMode string `koanf:"sslmode"`
|
|
}
|
|
|
|
// PostgreSQLSSLStorageConfiguration represents the SSL configuration of a PostgreSQL database.
|
|
type PostgreSQLSSLStorageConfiguration struct {
|
|
Mode string `koanf:"mode"`
|
|
RootCertificate string `koanf:"root_certificate"`
|
|
Certificate string `koanf:"certificate"`
|
|
Key string `koanf:"key"`
|
|
}
|
|
|
|
// StorageConfiguration represents the configuration of the storage backend.
|
|
type StorageConfiguration struct {
|
|
Local *LocalStorageConfiguration `koanf:"local"`
|
|
MySQL *MySQLStorageConfiguration `koanf:"mysql"`
|
|
PostgreSQL *PostgreSQLStorageConfiguration `koanf:"postgres"`
|
|
|
|
EncryptionKey string `koanf:"encryption_key"`
|
|
}
|
|
|
|
// DefaultSQLStorageConfiguration represents the default SQL configuration.
|
|
var DefaultSQLStorageConfiguration = SQLStorageConfiguration{
|
|
Timeout: 5 * time.Second,
|
|
}
|
|
|
|
// DefaultPostgreSQLStorageConfiguration represents the default PostgreSQL configuration.
|
|
var DefaultPostgreSQLStorageConfiguration = PostgreSQLStorageConfiguration{
|
|
Schema: "public",
|
|
SSL: PostgreSQLSSLStorageConfiguration{
|
|
Mode: "disable",
|
|
},
|
|
}
|