mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-27 19:41:11 +01:00
feat(api): enhance API handler to support unauthenticated local access
- Updated NewHandler function to accept a requireAuth parameter for authentication control. - Introduced a new local API server that allows unauthenticated access when LocalAPIHTTPAddr is set. - Adjusted server startup logic to handle both authenticated and unauthenticated API routes.
This commit is contained in:
11
cmd/main.go
11
cmd/main.go
@@ -69,9 +69,18 @@ func main() {
|
||||
server.StartServer(task.RootTask("api_server", false), server.Options{
|
||||
Name: "api",
|
||||
HTTPAddr: common.APIHTTPAddr,
|
||||
Handler: api.NewHandler(),
|
||||
Handler: api.NewHandler(true),
|
||||
})
|
||||
|
||||
// Local API Handler is used for unauthenticated access.
|
||||
if common.LocalAPIHTTPAddr != "" {
|
||||
server.StartServer(task.RootTask("local_api_server", false), server.Options{
|
||||
Name: "local_api",
|
||||
HTTPAddr: common.LocalAPIHTTPAddr,
|
||||
Handler: api.NewHandler(false),
|
||||
})
|
||||
}
|
||||
|
||||
listenDebugServer()
|
||||
|
||||
uptime.Poller.Start()
|
||||
|
||||
Reference in New Issue
Block a user