[{"data":1,"prerenderedAt":330},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fmain\u002Fdebug":3},{"id":4,"title":5,"body":6,"description":318,"extension":319,"group":320,"meta":321,"navigation":102,"order":322,"path":323,"section":324,"seo":325,"source":326,"stem":327,"version":328,"__hash__":329},"docs\u002Fdocs\u002Fmain\u002Fdebug.md","Debug mode and development pages",{"type":7,"value":8,"toc":311},"minimark",[9,13,18,21,68,120,147,151,161,200,206,210,225,232,236,243,262,268,271,274,278,302,307],[10,11,12],"p",{},"Debug pages are opt-in and disabled by default.",[14,15,17],"h2",{"id":16},"configure-a-generated-application","Configure a generated application",[10,19,20],{},"Set these environment variables in the process running your application:",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-sh shiki shiki-themes light-plus light-plus dark-plus","# Linux \u002F macOS\nDEBUG=true go tool gonex run\n","sh","",[29,30,31,40],"code",{"__ignoreMap":27},[32,33,36],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"sYH5r","# Linux \u002F macOS\n",[32,41,43,47,51,55,59,62,65],{"class":34,"line":42},2,[32,44,46],{"class":45},"sswaR","DEBUG",[32,48,50],{"class":49},"s_Yst","=",[32,52,54],{"class":53},"sFD8J","true",[32,56,58],{"class":57},"swoLU"," go",[32,60,61],{"class":53}," tool",[32,63,64],{"class":53}," gonex",[32,66,67],{"class":53}," run\n",[22,69,73],{"className":70,"code":71,"language":72,"meta":27,"style":27},"language-powershell shiki shiki-themes light-plus light-plus dark-plus","# PowerShell\n$env:DEBUG = \"true\"\ngo tool gonex run\n\n# Turn debugging off\n$env:DEBUG = \"false\"\n","powershell",[29,74,75,80,91,97,104,110],{"__ignoreMap":27},[32,76,77],{"class":34,"line":35},[32,78,79],{"class":38},"# PowerShell\n",[32,81,82,85,88],{"class":34,"line":42},[32,83,84],{"class":45},"$env:DEBUG",[32,86,87],{"class":49}," = ",[32,89,90],{"class":53},"\"true\"\n",[32,92,94],{"class":34,"line":93},3,[32,95,96],{"class":49},"go tool gonex run\n",[32,98,100],{"class":34,"line":99},4,[32,101,103],{"emptyLinePlaceholder":102},true,"\n",[32,105,107],{"class":34,"line":106},5,[32,108,109],{"class":38},"# Turn debugging off\n",[32,111,113,115,117],{"class":34,"line":112},6,[32,114,84],{"class":45},[32,116,87],{"class":49},[32,118,119],{"class":53},"\"false\"\n",[10,121,122,123,126,127,130,131,134,135,138,139,142,143,146],{},"The generated ",[29,124,125],{},"config.Load()"," maps the literal ",[29,128,129],{},"DEBUG=true"," to\n",[29,132,133],{},"config.Config.Debug",". Unset, ",[29,136,137],{},"false"," and other values disable debugging.\nThe core library stays explicit: manual applications set ",[29,140,141],{},"config.Config{Debug: true}",".\nEnvironment variables are read by the generated app, not automatically by the\nlibrary. A ",[29,144,145],{},".env.example"," is a reference; Gonex does not automatically load it.",[14,148,150],{"id":149},"existing-applications","Existing applications",[10,152,153,154,157,158,160],{},"Upgrading Gonex preserves handwritten configuration files. If your app was created\nbefore this feature, first update its Gonex dependency, then add the environment\nmapping to the ",[29,155,156],{},"config.Config"," value returned by your own ",[29,159,125],{},":",[22,162,166],{"className":163,"code":164,"language":165,"meta":27,"style":27},"language-go shiki shiki-themes light-plus light-plus dark-plus","Debug: os.Getenv(\"DEBUG\") == \"true\",\n","go",[29,167,168],{"__ignoreMap":27},[32,169,170,173,176,179,182,185,188,191,194,197],{"class":34,"line":35},[32,171,172],{"class":45},"Debug",[32,174,175],{"class":49},": ",[32,177,178],{"class":45},"os",[32,180,181],{"class":49},".",[32,183,184],{"class":57},"Getenv",[32,186,187],{"class":49},"(",[32,189,190],{"class":53},"\"DEBUG\"",[32,192,193],{"class":49},") == ",[32,195,196],{"class":53},"\"true\"",[32,198,199],{"class":49},",\n",[10,201,202,203,205],{},"This is a field inside the existing configuration literal. Keep the other fields\nand the existing ",[29,204,178],{}," import. Restart the application after setting the environment\nvariable.",[14,207,209],{"id":208},"welcome-page","Welcome page",[10,211,212,213,215,216,219,220,224],{},"With ",[29,214,129],{},", visiting ",[29,217,218],{},"GET \u002F"," shows ",[221,222,223],"strong",{},"Welcome to Gonex",", the Gonex duck,\nand links to the website and documentation. The image is embedded in the\nexecutable, so this page works offline and does not require a static directory.\nAn OpenAPI link appears only when OpenAPI is enabled.",[10,226,227,228,231],{},"Your own matching route always wins, including a custom root or catch-all route.\nWith ",[29,229,230],{},"DEBUG=false",", Gonex does not install the welcome page or debug image.\nNormal application routes continue to work.",[14,233,235],{"id":234},"browser-error-pages","Browser error pages",[10,237,238,239,242],{},"A browser request accepting ",[29,240,241],{},"text\u002Fhtml"," receives an HTML development page for\nuncommitted error responses, including:",[244,245,246,250,253,256,259],"ul",{},[247,248,249],"li",{},"404: request path and registered routes.",[247,251,252],{},"405: a method that is not supported by a registered route.",[247,254,255],{},"Binding\u002Fvalidation errors: status and validation information.",[247,257,258],{},"Returned handler errors: original error message, type and stack.",[247,260,261],{},"Panics: panic value and stack trace.",[10,263,264,265,267],{},"The page includes method, query-free path, matched route and request ID. HTML is\nescaped. Request bodies, headers, cookies, query strings and environment\nvariables are not dumped. Error strings and stacks can contain sensitive details,\nso keep ",[29,266,230],{}," on public deployments.",[10,269,270],{},"Requests for JSON (or without an explicit HTML preference) keep their normal API\nresponse shape and generic internal errors, even with debug enabled.\nThis preserves typed OpenAPI contracts for API clients.",[10,272,273],{},"Already committed responses, streams, hijacked connections and error responses\nover 64 KiB are not rewritten. Successful responses and streams pass through\nimmediately. Debug HTML is never cached and contains no external scripts.",[14,275,277],{"id":276},"disable-debugging-in-production","Disable debugging in production",[22,279,281],{"className":24,"code":280,"language":26,"meta":27,"style":27},"DEBUG=false\nGONEX_ENV=production\n",[29,282,283,292],{"__ignoreMap":27},[32,284,285,287,289],{"class":34,"line":35},[32,286,46],{"class":45},[32,288,50],{"class":49},[32,290,291],{"class":53},"false\n",[32,293,294,297,299],{"class":34,"line":42},[32,295,296],{"class":45},"GONEX_ENV",[32,298,50],{"class":49},[32,300,301],{"class":53},"production\n",[10,303,304,306],{},[29,305,296],{}," controls logging defaults; it does not implicitly turn debug on or off.\nThe two switches remain explicit. Restart the application after changing them.",[308,309,310],"style",{},"html pre.shiki code .sYH5r, html code.shiki .sYH5r{--shiki-light:#008000;--shiki-default:#008000;--shiki-dark:#6A9955}html pre.shiki code .sswaR, html code.shiki .sswaR{--shiki-light:#001080;--shiki-default:#001080;--shiki-dark:#9CDCFE}html pre.shiki code .s_Yst, html code.shiki .s_Yst{--shiki-light:#000000;--shiki-default:#000000;--shiki-dark:#D4D4D4}html pre.shiki code .sFD8J, html code.shiki .sFD8J{--shiki-light:#A31515;--shiki-default:#A31515;--shiki-dark:#CE9178}html pre.shiki code .swoLU, html code.shiki .swoLU{--shiki-light:#795E26;--shiki-default:#795E26;--shiki-dark:#DCDCAA}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":27,"searchDepth":42,"depth":42,"links":312},[313,314,315,316,317],{"id":16,"depth":42,"text":17},{"id":149,"depth":42,"text":150},{"id":208,"depth":42,"text":209},{"id":234,"depth":42,"text":235},{"id":276,"depth":42,"text":277},"Use DEBUG=true for the Gonex duck welcome page and browser error diagnostics, while keeping JSON API contracts and production responses unchanged.","md","GETTING STARTED",{},45,"\u002Fdocs\u002Fmain\u002Fdebug","build",{"title":5,"description":318},"debug.md","docs\u002Fmain\u002Fdebug","main","mPgfRTYao49A5N9yaQDNSB_QfMznTTii0MY0DPTSZmM",1792521640414]