feat: as docker mirror registry

feat: add global proxy config
upgrade: upgrade front(angular) to 19
chore: deployment staff
  1. Dockerfile: build frontend, backend, and run in nginx base image
This commit is contained in:
loveuer
2024-12-23 00:07:44 -08:00
parent aac6c67a5f
commit 6e866b83e4
57 changed files with 22226 additions and 7343 deletions

View File

@ -0,0 +1,61 @@
package rerr
import (
"github.com/loveuer/nf"
"net/http"
)
type RepositoryError struct {
Status int
Code string
Message string
}
func Error(c *nf.Ctx, err *RepositoryError) error {
return c.Status(err.Status).JSON(nf.Map{
"errors": []nf.Map{
{
"code": err.Code,
"message": err.Message,
},
},
})
}
func ErrInternal(err error) *RepositoryError {
return &RepositoryError{
Status: http.StatusInternalServerError,
Code: "INTERNAL_SERVER_ERROR",
Message: err.Error(),
}
}
var ErrBlobUnknown = &RepositoryError{
Status: http.StatusNotFound,
Code: "BLOB_UNKNOWN",
Message: "Unknown blob",
}
var ErrUnsupported = &RepositoryError{
Status: http.StatusMethodNotAllowed,
Code: "UNSUPPORTED",
Message: "Unsupported operation",
}
var ErrDigestMismatch = &RepositoryError{
Status: http.StatusBadRequest,
Code: "DIGEST_INVALID",
Message: "digest does not match contents",
}
var ErrDigestInvalid = &RepositoryError{
Status: http.StatusBadRequest,
Code: "NAME_INVALID",
Message: "invalid digest",
}
var ErrUnauthorized = &RepositoryError{
Status: http.StatusUnauthorized,
Code: "UNAUTHORIZED",
Message: "access to the requested resource is not authorized",
}