Hi,

how to get the port of the service in the vhost override hook in provision API?

https://github.com/EugenMayer/hosting_vhost_extra/blob/master/vhost_extr...

That works out of migrate, but not for verify ( not set ). Any ideas? ( #1058918: allow customization of site virtual hosts by the user )

Comments

anarcat’s picture

Status: Active » Fixed

If the http_port is missing, you can assume it's d()->server->default_port(), I believe. It's probably a bug that it's empty, but you can work around it.

That said, I do not understand what you're trying to do in that piece of code, I don't think you should be checking for ports, you mean to check ->ssl_enabled, no?

eugenmayer’s picture

cant check for ssl_enabled AFAIK as the object is not passed and it is not part of $data .. but thats an interesting idea

eugenmayer’s picture

Title: $data not always fully populated (missing port on verify) in provision API » Pass config object on provisoin.app / add documentations for nginx hooks
Category: support » feature
Status: Fixed » Needs review
StatusFileSize
new7.29 KB

anarcats advice was quiet useful, but it is not possible to do stuff like this with the current API. I attached a patch which extends the provision.api to pass the config object to the hook, which then makes it possible in that case e.g. to cann $config->ssl_enabled.

In addition i saw that the nginx hooks are not documented in provision.api.inc - i added them.

- We need to document nginx on http://community.aegirproject.org/node/70 and http://community.aegirproject.org/node/73

eugenmayer’s picture

Issue tags: +API, +documention

tags

memtkmcc’s picture

The patch from #3 has a few copy&paste typos for Nginx added stuff.

eugenmayer’s picture

StatusFileSize
new9.06 KB

fixed typos, added support for the settings hook.

memtkmcc’s picture

Still typo in the last function drush_hook_provision_apache_server_config.

eugenmayer’s picture

Title: Pass config object on provisoin.app / add documentations for nginx hooks » Pass config object on provisoin.api / add documentations for nginx hooks
anarcat’s picture

Status: Needs review » Needs work

I think the solution here is to make sure the data you are looking for is part of the $data array in the configuration. If it's not in there, then it's not designed to be in the config file, period. that's the way the API works.

So here, you want to make sure that the port or ssl config is part of the data array.

crea’s picture

Version: » 6.x-1.1

Subs

steven jones’s picture

Status: Needs work » Closed (won't fix)

Sorry that this issue has sat here and stagnated for so long. Anarcat in #9 suggests that the better way to go about this is to pass the data into the config template using the existing data structures rather than passing the object in, so if anyone wants to re-open with which stuff isn't getting passed in correctly for them, and a rough idea of what how to pass it in then feel free. Otherwise, I'm marking as won't fix, as clearly no-one is really interested in fixing this.