Skip to content

Copy latest certificate on before build #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2025

Conversation

gwleuverink
Copy link
Contributor

It turns out the cacert.pem file was only copied over during the serve command.
A build before at least running serve once was impossible due to the certificate not being present.

This PR adds a step to the build command to move the latest file over on every build.

@gwleuverink gwleuverink marked this pull request as draft February 28, 2025 15:53
@gwleuverink gwleuverink marked this pull request as ready for review February 28, 2025 15:54
Copy link
Member

@SRWieZ SRWieZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this handled by the JavaScript side ? Why does npm run dev do it and not npm run build ?

@PeteBishwhip
Copy link
Member

PeteBishwhip commented Feb 28, 2025

Isn't this handled by the JavaScript side ? Why does npm run dev do it and not npm run build ?

It doesn't. It's our serve/dev command that copies it. (See php.js)

If you go to build without ever running native:dev/serve, the cacert will not be present and the build will fail.

Even if you do, if you don't run dev after updating php-bin, you would not copy the latest version of cacert.pem whilst building.

Copy link
Member

@SRWieZ SRWieZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my question was: shouldn't we be consistent with the dev command?

I don't really like the current situation

"dev": "cross-env node php.js && electron-vite dev --watch",
"build": "electron-vite build",

The first step could be to move this PR to a Trait and use it in DevelopCommand and BuildCommand, and remove it from php.js.

Approved anyway 😉

@PeteBishwhip PeteBishwhip merged commit fa21cfe into main Feb 28, 2025
77 of 78 checks passed
@PeteBishwhip PeteBishwhip deleted the hotfix/cacert-copy-on-build branch February 28, 2025 16:58
@gwleuverink
Copy link
Contributor Author

@SRWieZ you're right. This should be consistent across the board.

I think it's covered in Pete's follow-up PR

@simonhamp
Copy link
Member

On the consistency issue: When we build, php.js is executed via electron-builder.js

I suspect the underlying reason for it failing was that the certificatePath variable wasn't being set on build, only on dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants