revert admin password logging to slog.Info (closes #26)
All checks were successful
check / check (push) Successful in 1m58s
All checks were successful
check / check (push) Successful in 1m58s
This commit is contained in:
parent
43c22a9e9a
commit
8f62fde8e9
@ -3,9 +3,7 @@ package database
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
"gorm.io/driver/sqlite"
|
"gorm.io/driver/sqlite"
|
||||||
@ -120,17 +118,10 @@ func (d *Database) migrate() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print the password directly to stderr so it never ends up in
|
d.log.Info("admin user created",
|
||||||
// structured JSON log aggregation. This message is only shown
|
"username", "admin",
|
||||||
// once on first startup.
|
"password", password,
|
||||||
fmt.Fprintf(os.Stderr, "\n"+
|
"message", "SAVE THIS PASSWORD - it will not be shown again!",
|
||||||
"==========================================================\n"+
|
|
||||||
" ADMIN USER CREATED\n"+
|
|
||||||
" Username: admin\n"+
|
|
||||||
" Password: %s\n"+
|
|
||||||
" SAVE THIS PASSWORD — it will not be shown again!\n"+
|
|
||||||
"==========================================================\n\n",
|
|
||||||
password,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user