File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " capture-template" ,
3
- "version" : " 1.0.11 " ,
3
+ "version" : " 1.0.12 " ,
4
4
"description" : " This library is responsible for expanding a template web page and then capturing it PNG or PDF." ,
5
5
"main" : " build/index.js" ,
6
6
"types" : " build/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ export interface ILog {
24
24
error ( msg : string ) : void ;
25
25
}
26
26
27
+ /**
28
+ * Environment variables to pass in when starting the Electrong process required for capturing.
29
+ */
30
+ export interface IEnvVars {
31
+ [ index : string ] : string ;
32
+ }
33
+
27
34
/**
28
35
* Specifies options that can be passed to the capture function.
29
36
*/
@@ -58,6 +65,11 @@ export interface ICaptureOptions {
58
65
* Specify the path to Electron if that's necessary for you.
59
66
*/
60
67
electronPath ?: string ;
68
+
69
+ /**
70
+ * Environment variables to pass in when starting the Electrong process required for capturing.
71
+ */
72
+ env ?: IEnvVars ;
61
73
}
62
74
63
75
//
Original file line number Diff line number Diff line change @@ -118,9 +118,16 @@ export class WebPageRenderer implements IWebPageRenderer {
118
118
openDevTools : this . options && this . options . openDevTools ,
119
119
} ;
120
120
121
- if ( this . options && this . options . electronPath ) {
122
- // Include Electron path if specified.
123
- nightmareOptions . electronPath = this . options . electronPath ;
121
+ if ( this . options ) {
122
+ if ( this . options . electronPath ) {
123
+ // Include Electron path if specified.
124
+ nightmareOptions . electronPath = this . options . electronPath ;
125
+ }
126
+
127
+ if ( this . options . env ) {
128
+ // Include Electron environment variables if specified.
129
+ nightmareOptions . env = this . options . env ;
130
+ }
124
131
}
125
132
126
133
this . nightmare = new Nightmare ( nightmareOptions ) ;
You can’t perform that action at this time.
0 commit comments