summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/license/finder/ext/npm.rb8
-rw-r--r--lib/license/management/shell.rb1
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/license/finder/ext/npm.rb b/lib/license/finder/ext/npm.rb
index 75c0855..48741f9 100644
--- a/lib/license/finder/ext/npm.rb
+++ b/lib/license/finder/ext/npm.rb
@@ -16,7 +16,7 @@ module LicenseFinder
def prepare
Dir.chdir(project_path) do
- shell.execute("#{prepare_command} --production")
+ shell.execute("#{prepare_command} --production", env: default_env)
end
end
@@ -32,5 +32,11 @@ module LicenseFinder
end
status.success? ? JSON.parse(stdout) : {}
end
+
+ def default_env
+ return {} unless shell.custom_certificate_installed?
+
+ { 'NPM_CONFIG_CAFILE' => ENV.fetch('NPM_CONFIG_CAFILE', shell.custom_certificate_path.to_s) }
+ end
end
end
diff --git a/lib/license/management/shell.rb b/lib/license/management/shell.rb
index fcf8188..7baa6ba 100644
--- a/lib/license/management/shell.rb
+++ b/lib/license/management/shell.rb
@@ -44,7 +44,6 @@ module License
Dir.chdir custom_certificate_path.dirname do
execute([:awk, SPLIT_SCRIPT, '<', custom_certificate_path])
execute('update-ca-certificates -v')
- execute([:npm, :config, :set, :cafile, custom_certificate_path])
Dir.glob('custom.*.crt').each do |path|
full_path = File.expand_path(path)