Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkg/commands/compute/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func (c *ServeCommand) Exec(in io.Reader, out io.Writer) (err error) {
}
}

if c.Globals.Verbose() && c.hasBackendsWithMissingOverrideHost() {
text.Info(out, "One of the project's `local_server.backends` has a backend configured without an `override_host` and in some cases can result in unexpected errors. See https://developer.fastly.com/reference/compute/fastly-toml/#local-server for more details.")
text.Break(out)
}

progress := text.ResetProgress(out, c.Globals.Verbose())

bin, err := GetViceroy(progress, out, c.av, c.Globals)
Expand Down Expand Up @@ -159,6 +164,17 @@ func (c *ServeCommand) Build(in io.Reader, out io.Writer) error {
return nil
}

// hasBackendsWithMissingOverrideHost indicates if any local_server.backends
// have a missing `override_host` property.
func (c *ServeCommand) hasBackendsWithMissingOverrideHost() bool {
for _, backend := range c.Globals.Manifest.File.LocalServer.Backends {
if backend.OverrideHost == "" {
return true
}
}
return false
}

// GetViceroy returns the path to the installed binary.
//
// NOTE: if Viceroy is installed then it is updated, otherwise download the
Expand Down
1 change: 1 addition & 0 deletions pkg/commands/secretstoreentry/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error {

case c.secretFile != "":
var err error
// nosemgrep: trailofbits.go.questionable-assignment.questionable-assignment
if c.Input.Secret, err = os.ReadFile(c.secretFile); err != nil {
return err
}
Expand Down