2019-04-24 21:52:08 +00:00
|
|
|
package schema
|
|
|
|
|
2021-08-06 05:35:14 +00:00
|
|
|
import "time"
|
|
|
|
|
2019-04-24 21:52:08 +00:00
|
|
|
// LocalStorageConfiguration represents the configuration when using local storage.
|
|
|
|
type LocalStorageConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
Path string `koanf:"path"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// SQLStorageConfiguration represents the configuration of the SQL database.
|
2019-11-16 10:38:21 +00:00
|
|
|
type SQLStorageConfiguration struct {
|
2021-08-06 05:35:14 +00:00
|
|
|
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"`
|
2019-11-16 10:38:21 +00:00
|
|
|
}
|
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// MySQLStorageConfiguration represents the configuration of a MySQL database.
|
2019-11-16 19:50:58 +00:00
|
|
|
type MySQLStorageConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
SQLStorageConfiguration `koanf:",squash"`
|
2019-11-16 19:50:58 +00:00
|
|
|
}
|
|
|
|
|
2021-12-02 05:36:03 +00:00
|
|
|
// PostgreSQLStorageConfiguration represents the configuration of a PostgreSQL database.
|
2019-11-16 19:50:58 +00:00
|
|
|
type PostgreSQLStorageConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
SQLStorageConfiguration `koanf:",squash"`
|
2021-12-02 05:36:03 +00:00
|
|
|
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"`
|
2019-11-16 19:50:58 +00:00
|
|
|
}
|
|
|
|
|
2019-04-24 21:52:08 +00:00
|
|
|
// StorageConfiguration represents the configuration of the storage backend.
|
|
|
|
type StorageConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
Local *LocalStorageConfiguration `koanf:"local"`
|
|
|
|
MySQL *MySQLStorageConfiguration `koanf:"mysql"`
|
|
|
|
PostgreSQL *PostgreSQLStorageConfiguration `koanf:"postgres"`
|
2021-11-25 01:56:58 +00:00
|
|
|
|
|
|
|
EncryptionKey string `koanf:"encryption_key"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
2021-08-06 05:35:14 +00:00
|
|
|
|
2021-12-02 05:36:03 +00:00
|
|
|
// DefaultSQLStorageConfiguration represents the default SQL configuration.
|
|
|
|
var DefaultSQLStorageConfiguration = SQLStorageConfiguration{
|
|
|
|
Timeout: 5 * time.Second,
|
2021-08-06 05:35:14 +00:00
|
|
|
}
|
2021-12-03 06:29:55 +00:00
|
|
|
|
|
|
|
// DefaultPostgreSQLStorageConfiguration represents the default PostgreSQL configuration.
|
|
|
|
var DefaultPostgreSQLStorageConfiguration = PostgreSQLStorageConfiguration{
|
|
|
|
Schema: "public",
|
|
|
|
SSL: PostgreSQLSSLStorageConfiguration{
|
|
|
|
Mode: "disable",
|
|
|
|
},
|
|
|
|
}
|