mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-17 20:50:56 +01:00
added status handler, so readyness+liveness-probes in k82 get some
This commit is contained in:
@@ -18,6 +18,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/compress"
|
"github.com/gofiber/fiber/v2/middleware/compress"
|
||||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
@@ -130,6 +131,9 @@ func Runserver(conf *cfg.Config, args []string) error {
|
|||||||
return FormPage(c, conf, db, shallExpire)
|
return FormPage(c, conf, db, shallExpire)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.Get("/status", func(c *fiber.Ctx) error {
|
||||||
|
return Status(c, conf)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup cleaner
|
// setup cleaner
|
||||||
|
|||||||
24
api/status_handlers.go
Normal file
24
api/status_handlers.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/tlinden/ephemerup/cfg"
|
||||||
|
"github.com/tlinden/ephemerup/common"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Status(c *fiber.Ctx, cfg *cfg.Config) error {
|
||||||
|
res := &common.Response{}
|
||||||
|
res.Success = true
|
||||||
|
res.Code = fiber.StatusOK
|
||||||
|
res.Message = "up and running"
|
||||||
|
return c.Status(fiber.StatusOK).JSON(res)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user