mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Improve health check endpoint to test database connection
This commit is contained in:
parent
c2571f9f47
commit
e3c28a6c96
4 changed files with 29 additions and 14 deletions
10
cli/cli.go
10
cli/cli.go
|
@ -126,17 +126,21 @@ func Parse() {
|
|||
config.Opts.DatabaseMaxConns(),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Fatal("Unable to connect to the database: %v", err)
|
||||
logger.Fatal("Unable to initialize database connection pool: %v", err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
store := storage.NewStorage(db)
|
||||
|
||||
if err := store.Ping(); err != nil {
|
||||
logger.Fatal("Unable to connect to the database: %v", err)
|
||||
}
|
||||
|
||||
if flagMigrate {
|
||||
database.Migrate(db)
|
||||
return
|
||||
}
|
||||
|
||||
store := storage.NewStorage(db)
|
||||
|
||||
if flagResetFeedErrors {
|
||||
store.ResetFeedErrors()
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue