fix: use connection string for postgres
This commit is contained in:
parent
4323803fd6
commit
fcb205a842
1 changed files with 4 additions and 3 deletions
|
@ -149,11 +149,12 @@ func parsePostgreSQLHostPort(info string) (string, string) {
|
||||||
|
|
||||||
func initPostgresEngine() (engine *xorm.Engine, err error) {
|
func initPostgresEngine() (engine *xorm.Engine, err error) {
|
||||||
host, port := parsePostgreSQLHostPort(config.DatabaseHost.GetString())
|
host, port := parsePostgreSQLHostPort(config.DatabaseHost.GetString())
|
||||||
connStr := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s sslcert=%s sslkey=%s sslrootcert=%s",
|
// postgresql://username:password@host:port/dbname[?paramspec]
|
||||||
host,
|
connStr := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s&sslcert=%s&sslkey=%s&sslrootcert=%s",
|
||||||
port,
|
|
||||||
config.DatabaseUser.GetString(),
|
config.DatabaseUser.GetString(),
|
||||||
config.DatabasePassword.GetString(),
|
config.DatabasePassword.GetString(),
|
||||||
|
host,
|
||||||
|
port,
|
||||||
config.DatabaseDatabase.GetString(),
|
config.DatabaseDatabase.GetString(),
|
||||||
config.DatabaseSslMode.GetString(),
|
config.DatabaseSslMode.GetString(),
|
||||||
config.DatabaseSslCert.GetString(),
|
config.DatabaseSslCert.GetString(),
|
||||||
|
|
Loading…
Reference in a new issue