Added some more logging and documented deploy procedures

This commit is contained in:
Lilleman auf Larv 2022-04-22 11:09:40 +02:00
parent c9871c817a
commit 9dcaa1ad39
2 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,10 @@ The account field "role" is a bit special, in that if it contains "admin" as one
Run integration tests (Requires migrated database and started API): `docker-compose run --rm tests` Run integration tests (Requires migrated database and started API): `docker-compose run --rm tests`
## Deploy a new version
Everytime a push is done, tests are ran on [Drone](https://drone.larvit.se/pwrpln/auth-api). To deploy a new version to [Dockerhub](https://hub.docker.com/repository/docker/lilleman/auth-api), create a new tag (USE SEMVER!!!).
## Some useful cURLs ## Some useful cURLs
Obtain an admin GWT: `curl -d '"api-key-goes-here"' -H "Content-Type: application/json" -i http://localhost:4000/auth/api-key` Obtain an admin GWT: `curl -d '"api-key-goes-here"' -H "Content-Type: application/json" -i http://localhost:4000/auth/api-key`

View File

@ -143,6 +143,8 @@ func (h Handlers) AccountAuthPassword(c *fiber.Ctx) error {
if err != nil { if err != nil {
if err.Error() == "no rows in result set" { if err.Error() == "no rows in result set" {
return c.Status(403).JSON([]ResJSONError{{Error: "Invalid name or password"}}) return c.Status(403).JSON([]ResJSONError{{Error: "Invalid name or password"}})
} else {
h.Log.Error("unknown error when resolving account", "err", err.Error())
} }
return c.Status(500).JSON([]ResJSONError{{Error: err.Error()}}) return c.Status(500).JSON([]ResJSONError{{Error: err.Error()}})