yml-config: Add support of rootUser and rootPassword (#18615)

Users can define the root user and password in the yaml configuration
file; Root credentials defined in the environment variable still take
precedence
This commit is contained in:
Anis Eleuch
2023-12-08 12:04:54 -08:00
committed by GitHub
parent aed7a1818a
commit 6f97663174
8 changed files with 136 additions and 8 deletions

View File

@@ -248,6 +248,10 @@ func mergeServerCtxtFromConfigFile(configFile string, ctxt *serverCtxt) error {
if cf.Version != "v1" {
return fmt.Errorf("unexpected version: %s", cf.Version)
}
ctxt.RootUser = cf.RootUser
ctxt.RootPwd = cf.RootPwd
if cf.Addr != "" {
ctxt.Addr = cf.Addr
}
@@ -353,11 +357,6 @@ func serverHandleCmdArgs(ctxt serverCtxt) {
globalConnWriteDeadline = ctxt.ConnWriteDeadline
}
func serverHandleEnvVars() {
// Handle common environment variables.
handleCommonEnvVars()
}
var globalHealStateLK sync.RWMutex
func initAllSubsystems(ctx context.Context) {
@@ -654,6 +653,10 @@ func serverMain(ctx *cli.Context) {
// Handle all server environment vars.
serverHandleEnvVars()
// Load the root credentials from the shell environment or from
// the config file if not defined, set the default one.
loadRootCredentials()
// Initialize globalConsoleSys system
bootstrapTrace("newConsoleLogger", func() {
globalConsoleSys = NewConsoleLogger(GlobalContext)