Implement health check for deploy. Make version endpoint to return revision if not set

This commit is contained in:
2026-03-25 23:48:48 +03:00
parent ee6b510e41
commit fc0c84f7f7
9 changed files with 100 additions and 15 deletions

View File

@@ -109,3 +109,17 @@ func (d *dbService) UpdatePayoutByPayoutID(payoutId string, updateModel orm.Payo
p := d.getParams(opts...)
return gorm.G[orm.Payout](d.db).Where("payout_id = ?", payoutId).Updates(p.ctx, updateModel)
}
// HealthCheck implements [Service].
func (d *dbService) HealthCheck() error {
if d.db == nil {
return errors.New("database connection is nil")
}
db, err := d.db.DB()
if err != nil {
return err
}
return db.Ping()
}

View File

@@ -31,6 +31,7 @@ type Service interface {
CreatePayout(payoutModel *orm.Payout, opts ...Optional) error
UpdatePayoutById(id uint, updateModel orm.Payout, opts ...Optional) (int, error)
UpdatePayoutByPayoutID(payoutId string, updateModel orm.Payout, opts ...Optional) (int, error)
HealthCheck() error
}
// Params represents the module input params

View File

@@ -1,10 +1,3 @@
/*
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
*
* You can not use the contents of the file in any way without New Cloud Technologies Ltd. written permission.
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at https://myoffice.ru/contacts/
*/
package config
import (