Get Panic when Activating a Repository

#1

When I try to active a repository with Gitea 1.8.0 using the latest drone docker image, I get a panic:

panic: runtime error: invalid memory address or nil pointer dereference
goroutine 86 [running]:
runtime/debug.Stack(0x48, 0x0, 0x0)
	/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/go-chi/chi/middleware.Recoverer.func1.1(0xc0006d6c00, 0x1ba9ce0, 0xc000774460)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/middleware/recoverer.go:28 +0x1b6
panic(0x171bf20, 0x2a6e3c0)
	/usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/drone/drone/service/hook.deleteHook(0x1bac820, 0xc0002c3a10, 0xc0001bf110, 0xc000740b30, 0xb, 0xc000740b50, 0x8, 0x2, 0xc000740b50)
	/drone/src/service/hook/util.go:34 +0x44
github.com/drone/drone/service/hook.replaceHook(0x1bac820, 0xc0002c3a10, 0xc0001bf110, 0xc000740b30, 0xb, 0xc0000b9a40, 0x8, 0xc0002c3a10)
	/drone/src/service/hook/util.go:25 +0x74
github.com/drone/drone/service/hook.(*service).Create(0xc0002c3ce0, 0x1bac820, 0xc0002c3a10, 0xc0006157c0, 0xc0003a2a00, 0xc00076a4cd, 0x5)
	/drone/src/service/hook/hook.go:57 +0x279
github.com/drone/drone/handler/api/repos.HandleEnable.func1(0x1ba9ce0, 0xc000774460, 0xc0006d7400)
	/drone/src/handler/api/repos/enable.go:68 +0x274
net/http.HandlerFunc.ServeHTTP(0xc0002d0100, 0x1ba9ce0, 0xc000774460, 0xc0006d7400)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/drone/drone/handler/api/acl.CheckAccess.func1.1(0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/drone/src/handler/api/acl/check.go:137 +0x6c3
net/http.HandlerFunc.ServeHTTP(0xc0002c3ef0, 0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi.(*ChainHandler).ServeHTTP(0xc0002d0140, 0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/chain.go:31 +0x52
github.com/go-chi/chi.(*Mux).routeHTTP(0xc0000d4300, 0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:424 +0x239
github.com/go-chi/chi.(*Mux).routeHTTP-fm(0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:368 +0x48
net/http.HandlerFunc.ServeHTTP(0xc0002ce150, 0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/drone/drone/handler/api/acl.CheckAccess.func1.1(0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/drone/src/handler/api/acl/check.go:99 +0xc90
net/http.HandlerFunc.ServeHTTP(0xc0002c3e60, 0x1ba9ce0, 0xc000774460, 0xc0006d7300)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/drone/drone/handler/api/acl.InjectRepository.func1.1(0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/drone/src/handler/api/acl/repo.go:133 +0xe28
net/http.HandlerFunc.ServeHTTP(0xc0000a3590, 0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc0000d4300, 0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:69 +0x44f
github.com/go-chi/chi.(*Mux).Mount.func1(0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:291 +0xf5
net/http.HandlerFunc.ServeHTTP(0xc00000d9a0, 0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc0000d42a0, 0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:424 +0x239
github.com/go-chi/chi.(*Mux).routeHTTP-fm(0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:368 +0x48
net/http.HandlerFunc.ServeHTTP(0xc0002ce4b0, 0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/cors.(*Cors).Handler.func1(0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/go/pkg/mod/github.com/go-chi/cors@v1.0.0/cors.go:199 +0xf2
net/http.HandlerFunc.ServeHTTP(0xc00000d9c0, 0x1ba9ce0, 0xc000774460, 0xc0006d7200)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/drone/drone/handler/api/auth.HandleAuthentication.func1.1(0x1ba9ce0, 0xc000774460, 0xc0006d6d00)
	/drone/src/handler/api/auth/auth.go:51 +0x30d
net/http.HandlerFunc.ServeHTTP(0xc0002d2bd0, 0x1ba9ce0, 0xc000774460, 0xc0006d6d00)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/drone/drone/logger.Middleware.func1(0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/drone/src/logger/handler.go:36 +0x282
net/http.HandlerFunc.ServeHTTP(0xc00000d9e0, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi/middleware.NoCache.func1(0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/middleware/nocache.go:54 +0x1e8
net/http.HandlerFunc.ServeHTTP(0xc00000da00, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi/middleware.Recoverer.func1(0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/middleware/recoverer.go:35 +0x9f
net/http.HandlerFunc.ServeHTTP(0xc00000da20, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc0000d42a0, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:69 +0x44f
github.com/go-chi/chi.(*Mux).Mount.func1(0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:291 +0xf5
net/http.HandlerFunc.ServeHTTP(0xc0002d8a00, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc0000d4240, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:424 +0x239
github.com/go-chi/chi.(*Mux).routeHTTP-fm(0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:368 +0x48
net/http.HandlerFunc.ServeHTTP(0xc0002ce0d0, 0x1ba9ce0, 0xc000774460, 0xc0006d6c00)
	/usr/local/go/src/net/http/server.go:1964 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc0000d4240, 0x1ba9ce0, 0xc000774460, 0xc0006d6b00)
	/go/pkg/mod/github.com/go-chi/chi@v3.3.3+incompatible/mux.go:81 +0x293
net/http.serverHandler.ServeHTTP(0xc0001bf520, 0x1ba9ce0, 0xc000774460, 0xc0006d6b00)
	/usr/local/go/src/net/http/server.go:2741 +0xab
net/http.(*conn).serve(0xc000615040, 0x1bac760, 0xc000698100)
	/usr/local/go/src/net/http/server.go:1847 +0x646
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2851 +0x2f5
#2

Solved by specifying a correct DRONE_SERVER_HOST. A configuration verification step during startup might help make first-time setup go smoother.