diff options
Diffstat (limited to 'internal/configuration/schema/storage.go')
| -rw-r--r-- | internal/configuration/schema/storage.go | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/internal/configuration/schema/storage.go b/internal/configuration/schema/storage.go index b51982a59..4bdf397f5 100644 --- a/internal/configuration/schema/storage.go +++ b/internal/configuration/schema/storage.go @@ -22,31 +22,36 @@ type StorageLocal struct { // StorageSQL represents the configuration of the SQL database. type StorageSQL struct { - Address *AddressTCP `koanf:"address" json:"address" jsonschema:"title=Address" jsonschema_description:"The address of the database."` + Address *AddressTCP `koanf:"address" json:"address" jsonschema:"title=Address" jsonschema_description:"The address of the SQL Server."` Database string `koanf:"database" json:"database" jsonschema:"title=Database" jsonschema_description:"The database name to use upon a successful connection."` Username string `koanf:"username" json:"username" jsonschema:"title=Username" jsonschema_description:"The username to use to authenticate."` Password string `koanf:"password" json:"password" jsonschema:"title=Password" jsonschema_description:"The password to use to authenticate."` Timeout time.Duration `koanf:"timeout" json:"timeout" jsonschema:"default=5 seconds,title=Timeout" jsonschema_description:"The timeout for the database connection."` + TLS *TLS `koanf:"tls" json:"tls"` } // StorageMySQL represents the configuration of a MySQL database. type StorageMySQL struct { StorageSQL `koanf:",squash"` - - TLS *TLS `koanf:"tls" json:"tls"` } // StoragePostgreSQL represents the configuration of a PostgreSQL database. type StoragePostgreSQL struct { StorageSQL `koanf:",squash"` - Schema string `koanf:"schema" json:"schema" jsonschema:"default=public,title=Schema" jsonschema_description:"The default schema name to use."` - TLS *TLS `koanf:"tls" json:"tls"` + Schema string `koanf:"schema" json:"schema" jsonschema:"default=public,title=Schema" jsonschema_description:"The default schema name to use."` + + Servers []StoragePostgreSQLServer `koanf:"servers" json:"servers" jsonschema:"title=Servers" jsonschema_description:"The fallback PostgreSQL severs to connect to in addition to the one defined by the address."` // Deprecated: Use the TLS configuration instead. SSL *StoragePostgreSQLSSL `koanf:"ssl" json:"ssl" jsonschema:"deprecated,title=SSL"` } +type StoragePostgreSQLServer struct { + Address *AddressTCP `koanf:"address" json:"address" jsonschema:"title=Address" jsonschema_description:"The address of the PostgreSQL Server."` + TLS *TLS `koanf:"tls" json:"tls"` +} + // StoragePostgreSQLSSL represents the SSL configuration of a PostgreSQL database. type StoragePostgreSQLSSL struct { Mode string `koanf:"mode" json:"mode" jsonschema:"deprecated,enum=disable,enum=verify-ca,enum=require,enum=verify-full,title=Mode" jsonschema_description:"The SSL mode to use, deprecated and replaced with the TLS options."` @@ -64,9 +69,9 @@ var DefaultSQLStorageConfiguration = StorageSQL{ var DefaultMySQLStorageConfiguration = StorageMySQL{ StorageSQL: StorageSQL{ Address: &AddressTCP{Address{true, false, -1, 3306, &url.URL{Scheme: AddressSchemeTCP, Host: "localhost:3306"}}}, - }, - TLS: &TLS{ - MinimumVersion: TLSVersion{tls.VersionTLS12}, + TLS: &TLS{ + MinimumVersion: TLSVersion{tls.VersionTLS12}, + }, }, } @@ -74,11 +79,19 @@ var DefaultMySQLStorageConfiguration = StorageMySQL{ var DefaultPostgreSQLStorageConfiguration = StoragePostgreSQL{ StorageSQL: StorageSQL{ Address: &AddressTCP{Address{true, false, -1, 5432, &url.URL{Scheme: AddressSchemeTCP, Host: "localhost:5432"}}}, + TLS: &TLS{ + MinimumVersion: TLSVersion{tls.VersionTLS12}, + }, }, - Schema: "public", - TLS: &TLS{ - MinimumVersion: TLSVersion{tls.VersionTLS12}, + Servers: []StoragePostgreSQLServer{ + { + Address: &AddressTCP{Address{true, false, -1, 5432, &url.URL{Scheme: AddressSchemeTCP, Host: "localhost:5432"}}}, + TLS: &TLS{ + MinimumVersion: TLSVersion{tls.VersionTLS12}, + }, + }, }, + Schema: "public", SSL: &StoragePostgreSQLSSL{ Mode: "disable", }, |
