mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: add site
flag to buildinfo
(#14868)
This commit is contained in:
@ -24,6 +24,9 @@ var (
|
|||||||
// Updated by buildinfo_slim.go on start.
|
// Updated by buildinfo_slim.go on start.
|
||||||
slim bool
|
slim bool
|
||||||
|
|
||||||
|
// Updated by buildinfo_site.go on start.
|
||||||
|
site bool
|
||||||
|
|
||||||
// Injected with ldflags at build, see scripts/build_go.sh
|
// Injected with ldflags at build, see scripts/build_go.sh
|
||||||
tag string
|
tag string
|
||||||
agpl string // either "true" or "false", ldflags does not support bools
|
agpl string // either "true" or "false", ldflags does not support bools
|
||||||
@ -95,6 +98,11 @@ func IsSlim() bool {
|
|||||||
return slim
|
return slim
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasSite returns true if the frontend is embedded in the build.
|
||||||
|
func HasSite() bool {
|
||||||
|
return site
|
||||||
|
}
|
||||||
|
|
||||||
// IsAGPL returns true if this is an AGPL build.
|
// IsAGPL returns true if this is an AGPL build.
|
||||||
func IsAGPL() bool {
|
func IsAGPL() bool {
|
||||||
return strings.Contains(agpl, "t")
|
return strings.Contains(agpl, "t")
|
||||||
|
7
buildinfo/buildinfo_site.go
Normal file
7
buildinfo/buildinfo_site.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//go:build embed
|
||||||
|
|
||||||
|
package buildinfo
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
site = true
|
||||||
|
}
|
@ -411,7 +411,7 @@ func (r *RootCmd) Command(subcommands []*serpent.Command) (*serpent.Command, err
|
|||||||
{
|
{
|
||||||
Flag: varNoOpen,
|
Flag: varNoOpen,
|
||||||
Env: "CODER_NO_OPEN",
|
Env: "CODER_NO_OPEN",
|
||||||
Description: "Suppress opening the browser after logging in.",
|
Description: "Suppress opening the browser when logging in, or starting the server.",
|
||||||
Value: serpent.BoolOf(&r.noOpen),
|
Value: serpent.BoolOf(&r.noOpen),
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
Group: globalGroup,
|
Group: globalGroup,
|
||||||
|
@ -492,7 +492,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
|||||||
BorderForeground(lipgloss.Color("12")).
|
BorderForeground(lipgloss.Color("12")).
|
||||||
Render(fmt.Sprintf("View the Web UI:\n%s",
|
Render(fmt.Sprintf("View the Web UI:\n%s",
|
||||||
pretty.Sprint(cliui.DefaultStyles.Hyperlink, accessURL))))
|
pretty.Sprint(cliui.DefaultStyles.Hyperlink, accessURL))))
|
||||||
_ = openURL(inv, accessURL)
|
if buildinfo.HasSite() {
|
||||||
|
err = openURL(inv, accessURL)
|
||||||
|
if err == nil {
|
||||||
|
cliui.Infof(inv.Stdout, "Opening local browser... You can disable this by passing --no-open.\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Used for zero-trust instance identity with Google Cloud.
|
// Used for zero-trust instance identity with Google Cloud.
|
||||||
googleTokenValidator, err := idtoken.NewValidator(ctx, option.WithoutAuthentication())
|
googleTokenValidator, err := idtoken.NewValidator(ctx, option.WithoutAuthentication())
|
||||||
|
Reference in New Issue
Block a user