wesleytodd / YeoPress

A Yeoman generator for WordPress
Other
1.08k stars 163 forks source link

Use of input.url? (adding port in local-wp-config.php) #167

Open brmullikin opened 8 years ago

brmullikin commented 8 years ago

I wondered what the intended use of the first prompt, the one asking for the url is? Is it simply to grab the port to add it to wp-config.php? Is it used anywhere else? I guess the follow up is, do people regularly specify a port for production in wp-config.php or is that mostly only used for development environments?

I use port forwarding in my dev environment (in my case 80 => 8080) but not in my production. So what is ideal for me is to have the dev port included in local-wp-config.php, but to omit it in the wp-config.php file. Likewise, the db credentials differ between the two (but I don't often know what the production credentials will be until closer to deployment).

Perhaps the prompts should be better organized to allow for both a dev and production environment when it comes to the url, port, & db credentials? (perhaps with --advanced)

My thought is, we could remove the url from the normal (non advanced) prompts (i.e. assume no port) and change the prompt to reflect more accurately that the information we are after is the port. And that we could further make a prompt conditional on wanting local-wp-config.php that asks for a local port, and even local db credentials.

I know you guys are busy, and will be happy to do a pull request. But wanted to run everything by the community first.

Cheers.

wesleytodd commented 8 years ago

Hey @brmullikin, thanks for opening the issue for discussion like this, that is really helpful.

So, the url is used for a few different things, mainly in the wp-config templating process. Secondly, I think it might be used in the vagrant setup (not sure about that though) if you choose that option, which is an advanced option so I can see the argument if this was the only reason. I also had intended to work on a way to automatically run through the 5min install part, which this setting would have been helpful for.

Now, as for your configuration thoughts, the local config is actually intended to be used only in a prod/preprod type environment. The idea is that you never want to commit things like database credentials to a repository. So you would put in all your development info into the generator, then we you are setting up a prod environment you would create a new local config file for yourself with the prod info.

Now, that all being said I am not against it if we are sure we don't need it. If you are willing to do a PR that does it more to your liking that also solves all of the existing feature needs then I am all for it.

brmullikin commented 8 years ago

I see. So you use the local-wp-config.php for deployment. We don't commit the local-wp-config.php either, but it's used for development purposes, so each dev can have their own local config environment with their own preferences (usually just their variant flavor of a vagrant box. But the issue usually ends up being different ports and default sql passwords among devs; some like to use 8080, others 8888 etc.). So far as deployment and not wanting credentials in the repo---I couldn't agree more! We usually end up using environment variables when we deploy (and those aren't generated until deployment). But that could easily be handled in a local-wp-config.php.

I see the merit now with the way it is currently set up. Let me think on this.

wesleytodd commented 8 years ago

There is nothing wrong with using it in both places, I just meant that the MAIN intention is for prod database passwords. Honestly I took another look and I think you might be right that we could make this an advanced option.