2022-02-11 10:02:47 +00:00
|
|
|
package initialise
|
|
|
|
|
|
|
|
import "github.com/caos/zitadel/internal/database"
|
|
|
|
|
|
|
|
type Config struct {
|
2022-02-16 12:30:49 +00:00
|
|
|
Database database.Config
|
|
|
|
AdminUser database.User
|
|
|
|
}
|
|
|
|
|
|
|
|
func adminConfig(config Config) database.Config {
|
|
|
|
adminConfig := config.Database
|
|
|
|
adminConfig.Username = config.AdminUser.Username
|
|
|
|
adminConfig.Password = config.AdminUser.Password
|
|
|
|
adminConfig.SSL.Cert = config.AdminUser.SSL.Cert
|
|
|
|
adminConfig.SSL.Key = config.AdminUser.SSL.Key
|
|
|
|
if config.AdminUser.SSL.RootCert != "" {
|
|
|
|
adminConfig.SSL.RootCert = config.AdminUser.SSL.RootCert
|
|
|
|
}
|
|
|
|
if config.AdminUser.SSL.Mode != "" {
|
|
|
|
adminConfig.SSL.Mode = config.AdminUser.SSL.Mode
|
|
|
|
}
|
|
|
|
//use default database because the zitadel database might not exist
|
|
|
|
adminConfig.Database = ""
|
|
|
|
|
|
|
|
return adminConfig
|
2022-02-11 10:02:47 +00:00
|
|
|
}
|