MCPcopy Create free account
hub / github.com/apecloud/myduckserver / InitSuperuser

Function InitSuperuser

pgserver/authentication_scram.go:44–62  ·  view source on GitHub ↗
(password string)

Source from the content-addressed store, hash-verified

42var EnableAuthentication = true
43
44func InitSuperuser(password string) {
45 auth.DropRole("doltgres")
46 auth.DropRole("postgres")
47
48 var err error
49 postgres := auth.CreateDefaultRole("postgres")
50 postgres.CanLogin = true
51 postgres.Password, err = auth.NewScramSha256Password(password)
52 if err != nil {
53 panic(err)
54 }
55 auth.SetRole(postgres)
56
57 // Postgres does not allow empty passwords,
58 // so we disable authentication if the superuser password is empty.
59 if password == "" {
60 EnableAuthentication = false
61 }
62}
63
64// SASLBindingFlag are the flags for gs2-cbind-flag, used in SASL authentication.
65type SASLBindingFlag string

Callers 1

NewServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected