MCPcopy Create free account
hub / github.com/cloudfoundry/nodejs-buildpack / InstallNode

Method InstallNode

src/nodejs/supply/supply.go:702–727  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

700}
701
702func (s *Supplier) InstallNode() error {
703 dep := libbuildpack.Dependency{
704 Name: "node",
705 Version: s.NodeVersion,
706 }
707
708 requiresSSLEnvVars, err := nodeVersionRequiresSSLEnvVars(s.NodeVersion)
709 if err != nil {
710 return err
711 }
712
713 if requiresSSLEnvVars {
714 os.Setenv("SSL_CERT_DIR", "/etc/ssl/certs")
715 }
716
717 nodeInstallDir := filepath.Join(s.Stager.DepDir(), "node")
718 if err := s.Installer.InstallDependency(dep, nodeInstallDir); err != nil {
719 return err
720 }
721
722 if err := s.Stager.LinkDirectoryInDepDir(filepath.Join(nodeInstallDir, "bin"), "bin"); err != nil {
723 return err
724 }
725
726 return os.Setenv("PATH", fmt.Sprintf("%s:%s", os.Getenv("PATH"), filepath.Join(s.Stager.DepDir(), "bin")))
727}
728
729func nodeVersionRequiresSSLEnvVars(version string) (bool, error) {
730 // NOTE: ensures OpenSSL CA store works with Node v20 and higher. Waiting

Callers 2

supply_test.goFile · 0.80
RunFunction · 0.80

Calls 4

DepDirMethod · 0.65
InstallDependencyMethod · 0.65
LinkDirectoryInDepDirMethod · 0.65

Tested by

no test coverage detected