优化
This commit is contained in:
@@ -24,6 +24,20 @@ import (
|
||||
|
||||
var databaseNamePattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_$-]*$`)
|
||||
|
||||
// databaseConnectionConfigured mirrors the initialization contract of the
|
||||
// administration backend: an explicitly selected database (or a standalone
|
||||
// DSN) means a real database connection is expected to exist. The internal
|
||||
// bootstrap database is deliberately excluded from this state.
|
||||
func databaseConnectionConfigured(c *conf.Data_Database) bool {
|
||||
if c == nil {
|
||||
return false
|
||||
}
|
||||
if strings.TrimSpace(c.Name) != "" {
|
||||
return true
|
||||
}
|
||||
return strings.TrimSpace(c.Source) != "" && strings.TrimSpace(c.Host) == "" && strings.TrimSpace(c.Path) == ""
|
||||
}
|
||||
|
||||
func normalizedDriver(driver string) string {
|
||||
switch strings.ToLower(strings.TrimSpace(driver)) {
|
||||
case "postgres", "postgresql", "pgsql":
|
||||
|
||||
Reference in New Issue
Block a user