cli/cmd/build.go
Jake Cooper 3624a5eec6
Add Linting for CLI (#76)
* Add Linting for CLI

* Fire CI

* Remove checkout oopsie

* Newlint

* Clean modcache for now

* Lint fixes

* Fix failed to write error

* Fix CI issues

* Workflow comments

* Fix print lint errs

* Fix

* Fix lint issues

* Update cmd/build.go

Co-authored-by: Jake Runzer <jakerunzer@gmail.com>

* Update cmd/whoami.go

Co-authored-by: Jake Runzer <jakerunzer@gmail.com>

Co-authored-by: Jake Runzer <jakerunzer@gmail.com>
2021-03-30 11:33:30 -07:00

24 lines
522 B
Go

package cmd
import (
"context"
"fmt"
"github.com/railwayapp/cli/entity"
)
func (h *Handler) Build(ctx context.Context, req *entity.CommandRequest) error {
if h.cfg.RailwayProductionToken == "" {
fmt.Println("Railway env file is only generated in production")
return nil
}
err := h.ctrl.SaveEnvsToFile(ctx)
if err != nil {
return err
}
fmt.Printf(`Env written to %s
Do NOT commit the env.json file. This command should only be run as a production build step.\n`, h.cfg.RailwayEnvFilePath)
return nil
}