Skip to content

Commit 764733a

Browse files
amine7536findleyr
authored andcommitted
cmd/frontend: add -local flag to run frontend in LocalMode
The frontend UI show/hide elements and links based on whether the frontend server is running in `LocalMode`. For the `frontend` this value is hardcoded to `false`. This PR adds the flag `-local` to allow starting the frontend in `LocalMode`. This is particularly beneficial for those who wish to run the `frontend` locally or self-host for internal packages. Fixes golang/go#60872 Change-Id: I355419bfef65bdbd970d7e602775d44ee8755c10 GitHub-Last-Rev: 4a8140a GitHub-Pull-Request: #66 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/504336 Reviewed-by: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Peter Weinberger <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent 15dd281 commit 764733a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cmd/frontend/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var (
3737
staticFlag = flag.String("static", "static", "path to folder containing static files served")
3838
thirdPartyPath = flag.String("third_party", "third_party", "path to folder containing third-party libraries")
3939
devMode = flag.Bool("dev", false, "enable developer mode (reload templates on each page load, serve non-minified JS/CSS, etc.)")
40+
localMode = flag.Bool("local", false, "enable local mode (hide irrelevant content and links to go.dev)")
4041
disableCSP = flag.Bool("nocsp", false, "disable Content Security Policy")
4142
proxyURL = flag.String("proxy_url", "https://proxy.golang.org", "Uses the module proxy referred to by this URL "+
4243
"for direct proxy mode and frontend fetches")
@@ -120,6 +121,7 @@ func main() {
120121
StaticPath: *staticFlag,
121122
ThirdPartyFS: os.DirFS(*thirdPartyPath),
122123
DevMode: *devMode,
124+
LocalMode: *localMode,
123125
ReportingClient: rc,
124126
VulndbClient: vc,
125127
})

0 commit comments

Comments
 (0)