mirror of
https://github.com/distribution/distribution.git
synced 2025-09-19 18:02:52 +00:00
cleanup: move init funcs to the top of the source
We make sure they're not hiding at the bottom or in the middle which makes debugging an utter nightmare! Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
@@ -16,6 +16,13 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// init registers the silly auth backend.
|
||||
func init() {
|
||||
if err := auth.Register("silly", auth.InitFunc(newAccessController)); err != nil {
|
||||
logrus.Errorf("failed to register silly auth: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// accessController provides a simple implementation of auth.AccessController
|
||||
// that simply checks for a non-empty Authorization header. It is useful for
|
||||
// demonstration and testing.
|
||||
@@ -85,10 +92,3 @@ func (ch challenge) SetHeaders(r *http.Request, w http.ResponseWriter) {
|
||||
func (ch challenge) Error() string {
|
||||
return fmt.Sprintf("silly authentication challenge: %#v", ch)
|
||||
}
|
||||
|
||||
// init registers the silly auth backend.
|
||||
func init() {
|
||||
if err := auth.Register("silly", auth.InitFunc(newAccessController)); err != nil {
|
||||
logrus.Errorf("failed to register silly auth: %v", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user