Skip to content
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

[0.6.x] Support loading certificates from environment variables #151

Merged
merged 5 commits into from
Oct 11, 2022

Conversation

innocenzi
Copy link
Contributor

@innocenzi innocenzi commented Sep 28, 2022

This PR adds support for loading certificates thanks to paths defined in the environment.

Currently, in our team, we use valetTls, which is very nice for us Valet users. But a member of our team uses Windows and Laragon, and cannot benefit from the configuration.

With this PR, they will be able to define VITE_DEV_SERVER_KEY and VITE_DEV_SERVER_CERT in their .env with the paths to their Laragon certificates. That way, there is no need to touch vite.config.ts, so it can keep being environment-agnostic.

Keeping this as a draft to test it on my own Windows machine later - also, not so sure about the variable names: VITE_* environment variables are available in the front-end through import.meta.env.

@innocenzi innocenzi changed the title feat: support loading certificates from environment Support loading certificates from environment Sep 28, 2022
@innocenzi innocenzi changed the title Support loading certificates from environment Support loading certificates from environment variables Sep 28, 2022
@innocenzi innocenzi marked this pull request as ready for review October 7, 2022 12:54
@innocenzi
Copy link
Contributor Author

This pull request is ready for review. If you have a better name for VITE_DEV_SERVER_KEY/CERT, feel free to suggest.

@timacdonald
Copy link
Member

timacdonald commented Oct 10, 2022

Seems good to me! I've added some error messages to hopefully guide the user when we cannot find the specified paths or determine the host (instead of silently failing):

Screen Shot 2022-10-11 at 10 40 45 am

Screen Shot 2022-10-11 at 10 42 55 am

@timacdonald timacdonald changed the title Support loading certificates from environment variables [0.6.x] Support loading certificates from environment variables Oct 10, 2022
@taylorotwell taylorotwell merged commit 8fbb885 into laravel:main Oct 11, 2022
@innocenzi innocenzi deleted the feat/https-certificates-from-env branch October 11, 2022 17:44
@timacdonald
Copy link
Member

Thanks for contributing to the core plugin @innocenzi ❤️ you rock.

@timacdonald
Copy link
Member

@innocenzi I'm wondering if we should first use the ASSET_URL and then fallback to the APP_URL here?

What do you think?

The official plugin uses the asset helper for all generated URLs.

@innocenzi
Copy link
Contributor Author

Admittedly I never used ASSET_URL in development myself so I'm not too sure. I imagine it could make sense when using Docker but I don't know the setup :/

I would say, we should probably wait for people with such setups to provide feedback if what the plugin offers doesn't work for them

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.

3 participants