mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 04:50:14 +09:00
26 lines
469 B
Go
26 lines
469 B
Go
package cli
|
|
|
|
import (
|
|
"chat/admin"
|
|
"chat/connection"
|
|
"errors"
|
|
)
|
|
|
|
func UpdateRootCommand(args []string) {
|
|
db := connection.ConnectDatabase()
|
|
cache := connection.ConnectRedis()
|
|
|
|
if len(args) == 0 {
|
|
outputError(errors.New("invalid arguments, please provide a new root password"))
|
|
return
|
|
}
|
|
|
|
password := args[0]
|
|
if err := admin.UpdateRootPassword(db, cache, password); err != nil {
|
|
outputError(err)
|
|
return
|
|
}
|
|
|
|
outputInfo("root", "root password updated")
|
|
}
|