mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-27 08:43:10 -06:00
- Update YAML file to use file: everywhere except for Accounts - Use the CosmosDB conn string in the YAML - Add cosmosdbapi package to wrap the external package - Add Tenant.go to store the tenancy settings - to be removed when tenancy is implemented - Update the 5 tables to use the internal CosmosDBAPI package instead of SQL - Remove sql from storage.go and other files
22 lines
621 B
Go
22 lines
621 B
Go
package cosmosdbutil
|
|
|
|
import (
|
|
"github.com/matrix-org/dendrite/setup/config"
|
|
"strings"
|
|
)
|
|
|
|
func GetConnectionString(d *config.DataSource) config.DataSource {
|
|
var connString string
|
|
connString = string(*d)
|
|
return config.DataSource(strings.Replace(connString, "cosmosdb:", "", 1))
|
|
}
|
|
|
|
func GetConnectionProperties(connectionString string) map[string]string {
|
|
connectionItemsRaw := strings.Split(connectionString, ";")
|
|
connectionItems := map[string]string{}
|
|
for _, item := range connectionItemsRaw {
|
|
itemSplit := strings.SplitN(item, "=", 2)
|
|
connectionItems[itemSplit[0]] = itemSplit[1]
|
|
}
|
|
return connectionItems
|
|
} |