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
|
|
|
}
|
|
|
|
|
2020-05-02 05:06:39 +00:00
|
|
|
// PostgreSQLStorageConfiguration represents the configuration of a Postgres database.
|
2019-11-16 19:50:58 +00:00
|
|
|
type PostgreSQLStorageConfiguration struct {
|
2021-08-03 09:55:21 +00:00
|
|
|
SQLStorageConfiguration `koanf:",squash"`
|
|
|
|
SSLMode string `koanf:"sslmode"`
|
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"`
|
2019-04-24 21:52:08 +00:00
|
|
|
}
|
2021-08-06 05:35:14 +00:00
|
|
|
|
|
|
|
// DefaultPostgreSQLStorageConfiguration represents the default PostgreSQL configuration.
|
|
|
|
var DefaultPostgreSQLStorageConfiguration = PostgreSQLStorageConfiguration{
|
|
|
|
SQLStorageConfiguration: SQLStorageConfiguration{
|
|
|
|
Timeout: 5 * time.Second,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// DefaultMySQLStorageConfiguration represents the default MySQL configuration.
|
|
|
|
var DefaultMySQLStorageConfiguration = MySQLStorageConfiguration{
|
|
|
|
SQLStorageConfiguration: SQLStorageConfiguration{
|
|
|
|
Timeout: 5 * time.Second,
|
|
|
|
},
|
|
|
|
}
|