package flag var ( Host string Port int Token string Version string Mode string Insecure bool ReadOnly bool Debug bool AllowedTools map[string]struct{} // TokenSource records where flag.Token was loaded from when the process // started: "flag", "env", "env-file", or "" if no startup token was set. // Per-request tokens from the Authorization header bypass this and are // labelled "header" in the context value instead. TokenSource string // DebugScopes restricts what categories of debug output are emitted when // Debug is true. An empty set means "everything" (the default). Known // scopes: "tools", "http", "config". Parsed from GITEA_DEBUG_SCOPES. DebugScopes map[string]struct{} ) // DebugScopeEnabled reports whether a given debug scope should be logged. // Returns true if Debug is off (so callers don't accidentally activate logs // they shouldn't), false. When Debug is on and DebugScopes is empty, all // scopes are enabled. func DebugScopeEnabled(scope string) bool { if !Debug { return false } if len(DebugScopes) == 0 { return true } _, ok := DebugScopes[scope] return ok }