8000 Add cacert.pem to state and default PHP settings · NativeLaravel/electron-plugin@28e9cc4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 28e9cc4

Browse files
committed
Add cacert.pem to state and default PHP settings
1 parent 1101f0e commit 28e9cc4

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ const killChildProcesses = () => {
2929
}
3030

3131
class NativePHP {
32-
public bootstrap(app: CrossProcessExports.App, icon: string, phpBinary: string) {
32+
public bootstrap(app: CrossProcessExports.App, icon: string, phpBinary: string, cert: string) {
3333
require('@electron/remote/main').initialize();
3434

3535
state.icon = icon;
3636
state.php = phpBinary;
37+
state.caCert = cert;
3738

3839
this.bootstrapApp(app);
3940
this.addEventListeners(app);

src/server/php.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ async function retrieveNativePHPConfig() {
3636
}
3737

3838
function callPhp(args, options) {
39+
// Add mandatory php.ini settings
40+
args.unshift(
41+
'-d', 'memory_limit=512M',
42+
'-d', 'curl.cainfo=' + state.caCert,
43+
'-d', 'openssl.cafile=' + state.caCert
44+
);
45+
3946
return spawn(
4047
state.php,
4148
args,

src/server/state.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import { BrowserWindow } from "electron";
33
interface State {
44
activeMenuBar: any;
55
php: string | null;
6+
caCert: string | null;
67
icon: string | null
78
windows: Record<string, BrowserWindow>
89
}
910

1011
export default {
1112
activeMenuBar: null,
1213
php: null,
14+
caCert: null,
1315
icon: null,
1416
windows: {}
1517
} as State;

0 commit comments

Comments
 (0)
0