From 9a4fe2920460eac076ec2015bd08ba38c3d27aaa Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 6 Oct 2020 14:58:55 +0800 Subject: [PATCH] cmake: read $NPM_REGISTRY for npm registry mirror in case the offical npm registry is slow or unreachable. Signed-off-by: Kefu Chai --- src/pybind/mgr/dashboard/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/CMakeLists.txt b/src/pybind/mgr/dashboard/CMakeLists.txt index cb692cba752f..dd6aa9f0e718 100644 --- a/src/pybind/mgr/dashboard/CMakeLists.txt +++ b/src/pybind/mgr/dashboard/CMakeLists.txt @@ -59,11 +59,15 @@ else(WITH_SYSTEM_NPM) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "dashboard nodeenv is being installed" ) + if(DEFINED ENV{NPM_REGISTRY}) + set(npm_registry_opts "OPTION" "registry=$ENV{NPM_REGISTRY}") + endif() add_npm_options( NODEENV_DIR ${mgr-dashboard-nodeenv-dir} TARGET mgr-dashboard-nodeenv OPTION python=${MGR_PYTHON_EXECUTABLE} - OPTION cache=${mgr-dashboard-nodeenv-dir}/.npm) + OPTION cache=${mgr-dashboard-nodeenv-dir}/.npm + ${npm_registry_opts}) add_custom_target(mgr-dashboard-frontend-deps DEPENDS frontend/node_modules mgr-dashboard-nodeenv WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend -- 2.47.3