File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,13 +58,27 @@ if (existsSync(dist)) {
5858
5959const bin_path = path . resolve ( source_root , 'bin' ) ;
6060
61- const search_paths = [
62- path . join ( bin_path , platformDir , binary_name ) ,
61+ let search_paths = [
62+ path . join ( bin_path , platformDir , binary_name ) + '.node' ,
6363] ;
6464
65+ /*
66+ * Environment variables can inject (at lower-priority) paths into the search process as well. Support both relative
67+ * and absolute path overrides.
68+ */
69+ let relative_path = process . env . AWS_CRT_NODEJS_BINARY_RELATIVE_PATH ;
70+ if ( relative_path ) {
71+ let final_path = path . resolve ( __dirname , ...relative_path . split ( path . sep ) )
72+ search_paths . push ( final_path ) ;
73+ }
74+
75+ if ( process . env . AWS_CRT_NODEJS_BINARY_ABSOLUTE_PATH ) {
76+ search_paths . push ( process . env . AWS_CRT_NODEJS_BINARY_ABSOLUTE_PATH ) ;
77+ }
78+
6579let binding ;
6680for ( const path of search_paths ) {
67- if ( existsSync ( path + '.node' ) ) {
81+ if ( existsSync ( path ) ) {
6882 binding = require ( path ) ;
6983 break ;
7084 }
You can’t perform that action at this time.
0 commit comments