-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow overriding dev server settings using env variables #843
Conversation
Do we need to support dotenv with this change? I'm hesitant to add another dependency, and would prefer to start by just reading |
Yeah, I was too but later felt since we are encapsulating configs inside a node module it would make sense to provide |
I think people using |
Yeah, totally but it's not that trivial to setup. Here is our doc about supplying env variable to Webpacker: https://github.com/rails/webpacker/blob/master/docs/env.md (which basically requires overriding Environment plugin). |
I think this warning explain why we shouldn't add a default env manager and leave it to the users. |
Makes sense 👍 |
ab15354
to
8416ca0
Compare
@guilleiguaran Could you please review and merge this one? I have dropped |
8416ca0
to
97fd48b
Compare
97fd48b
to
7bd2c93
Compare
I can understand using ENV variables, but why specifically remove support for ARGV also? Unable to use https certificates that I would usually expect to pass to webpack-dev-server like so:
|
Hey @timkrins The previous implementation was limited. Webpacker uses dev server options (webpacker.yml or ENV) for an internal rake middleware and it was a bit complex to allow three sources for overriding dev server configuration - cli, webpacker.yml and ENV This could be unified but haven't had time to look into this properly. For now, you could supply certs through For example: // development.js
environment.config.merge({
devServer: {
https: {
key: fs.readFileSync('/path/to/server.key'),
cert: fs.readFileSync('/path/to/server.crt'),
ca: fs.readFileSync('/path/to/ca.pem'),
}
}
}) |
Hi @gauravtiwari , Thanks for the explanation. I think as the webpacker I am aware I can do what you recommended, however, it is just a bit annoying not to be able to have access to do this via the commandline, when I know that Is there a potential conflict adding ARGV to the
|
Ah, I can see I'm not the only one confused by this - just found #1672 |
Can someone explain how to set the port for the webpacker dev server so that it is used by both the server and the client using a .env file or similar (as requested in #767)? I'm missing something simple, I'm sure, but I've been able to change the devServer port, but the client continues to use the port out of the webpacker.yml file. The only thing that has worked so far is to physically change the webpacker.yml file. I want to avoid that because I want to be able to run two versions of the app server at the same time and don't want to be changing a file that gets checked into the repository Rails 5.1.7 Running app server through puma_dev. Thanks. |
Same here. ENV var overrides such as:
are not working. Rails 6.0.3.2 |
This PR removes cli args support for webpack dev server and adds support for env variables within Webpacker to override dev server settings.
For overriding dev server settings, simply set env variable before calling webpacker.
All settings for dev server inside
config/webpacker.yml
can be overriden, just make sure they are in caps.