Silvan 4272ea6fe1
fix: init sub commands (#3218)
* fix(init): add sub commands

* fix(init): admin user in config,
test(init): verify functions

* refactor: config, remove second commands

* refactor: init steps

* chore: fix link in readme

* chore: numerate sql files

* Update cmd/admin/initialise/sql/README.md

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update cmd/admin/initialise/sql/README.md

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* fix(init): remove unused index

* user

* fix database username in defaults.yaml

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2022-02-16 12:30:49 +00:00

27 lines
743 B
Go

package initialise
import "github.com/caos/zitadel/internal/database"
type Config struct {
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
}