MCPcopy Index your code
hub / github.com/jetify-com/devbox / checkOldEnvrc

Method checkOldEnvrc

internal/devbox/devbox.go:963–990  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

961}
962
963func (d *Devbox) checkOldEnvrc() error {
964 envrcPath := filepath.Join(d.ProjectDir(), ".envrc")
965 noUpdate, err := strconv.ParseBool(os.Getenv("DEVBOX_NO_ENVRC_UPDATE"))
966 if err != nil {
967 // DEVBOX_NO_ENVRC_UPDATE is either not set or invalid
968 // so we consider it the same as false
969 noUpdate = false
970 }
971 // check if user has an old version of envrc
972 if fileutil.Exists(envrcPath) && !noUpdate {
973 isNewEnvrc, err := fileutil.FileContains(
974 envrcPath,
975 "eval \"$(devbox generate direnv --print-envrc)\"",
976 )
977 if err != nil {
978 return err
979 }
980 if !isNewEnvrc {
981 ux.Fwarningf(
982 d.stderr,
983 "Your .envrc file seems to be out of date. "+
984 "Run `devbox generate direnv --force` to update it.\n"+
985 "Or silence this warning by setting DEVBOX_NO_ENVRC_UPDATE=1 env variable.\n",
986 )
987 }
988 }
989 return nil
990}
991
992// configEnvs takes the existing environment (nix + plugin) and adds env
993// variables defined in Config. It also parses variables in config

Callers 1

computeEnvMethod · 0.95

Calls 4

ProjectDirMethod · 0.95
ExistsFunction · 0.92
FileContainsFunction · 0.92
FwarningfFunction · 0.92

Tested by

no test coverage detected